Caché Web Applications Tutorial
Class versus Instance Methods
[Back] 
   
Server:docs1
Instance:LATEST
User:UnknownUser
 
-
Search:    

To understand the difference between a class method and an instance method, we need to go back to the distinction of class and object. Remember that a class is a definition while an object is an instance of that definition. For example, our application has one TicketOrder class, which defines the properties and methods of many TicketOrder objects.

An instance method is invoked from a specific object. To run an instance method, an object must exist in memory.
By contrast, a class method does not require a specific instance. It can be used even if no instance of the class exists in memory.
By default, all methods in the classes created for Caché Server Pages are class methods. This enables Caché to avoid the overhead of creating a page object for each request.