Cold Help System: Programming: ColdC Reference Manual: Objects: Methods


A method is a series of ColdC statements which are grouped together as a procedure, to perform a task. Method's are given a name and bound to a specific object. Methods determine the object's behavior.

Methods have a specific structure to them. The number of arguments they will accept is defined at the beginning of the method, followed by the definition all of the variables used within the method. Subsequent lines compose the actual method (See Defining Methods for more information on method structure).

When descendants of an object wish to change their behavior, they may define their own methods, or override a method defined on an ancestor. A method is overriden by simply naming it the same as an existing method on an ancestor of the object. When a method is called, the interpreter looks for it first on the object, then on the object's ancestors. If this occurs, it is possible for a method overriding another to stop executing and pass back to the method on its ancestor, and then resume executing when the overriden method completes executing.

It is possible for a method to disallow descendants to override a method, see Defining Methods.


Referencing Objects | Methods | Variables | Special Object Status


the Cold Dark