The ::METHOD Directive

After writing a ::CLASS directive, use a ::METHOD directive to create a method for that class and define the method's attributes. The next directive in the program, or the end of the program, will end the method.

Some classes you define will have an INIT method. INIT is called whenever a NEW message is sent to a class. The INIT method should contain whatever code is needed to initialize the object.

While it is not required that a ::METHOD directive be preceded by a ::CLASS directive, without it the method is only accessible to the executable part of the program through REXX's .METHODS environment symbol. This symbol identifies a directory of methods that you can refer to by name. Only one method directive can appear for any method name not associated with a class.

As with the ::CLASS directive, the ::METHOD directive has a number of useful options; in this case they are used for:


[Back: The ::CLASS Directive]
[Next: The ::ROUTINE Directive]