Method Command Syntax
Method (Va type_name) (Va Method_name) (Fn Program_name)
Syntax
Method type_name method_name program_name
Argument Description
type_name Variable: Name of the Type for which the method is defined
method_name Variable: Name of the method being declared. If this is the same as the name
of a parent type's method, then this local declaration overrides the parent's
method in the sense that it is used rather than the parent's method.
Program_name Function or Program name: The method, when implemented will use the Function
or Program. The program must be defined before any method that will refer to
it is declared in a Method command; of course the method must be declared before
any message is sent that invokes this method. The Function or program may
take any number of arguments.
Remarks: If an object has instance variable: color, then the methods putcolor and color are automatically created when the type is defined. They respectively set
the value of color, or get the value of color. These are the accessor methods. All other methods must be defined
explicitly using the Method Command, and, if necessary, a program definition. Such a
program definition is unnecessary if the method is inherited from an ancestor,
unless the new method is to override the inherited method. In any case, you are
free to use any name you choose for the program name.
.
See also: Type
Send
Object
Get
Object oriented programming in MathScript