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. More on method structure is available later in this manual.
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. It is possible for a method overriding another to stop executing and pass back to the method on it's ancestor, and then resume executing when the overriden method is completed.
It is possible for a method to disallow descendants to override a method, See Defining Methods.
Last Modified on Jan 25 1996
Copyright © 1995, 1996, Brandon Gillespie