Product Site

5.1.1.7. define

Incorporates the method object method in the receiver class's collection of instance methods. The method name methodname is translated to uppercase. Using the define method replaces any existing definition for methodname in the receiver class.

If you omit method, the method name methodname is made unavailable for the receiver class. Sending a message of that name to an instance of the class causes the unknown method (if any) to be run.

The method argument can be a string containing a method source line instead of a method object. Alternatively, you can pass an array of strings containing individual method lines. Either way, define creates an equivalent method object.

Notes:
  1. The classes Rexx provides do not permit changes or additions to their method definitions.
  2. The define method is a protected method.
Example 5.2. Class class — define method
bank_account=.object~subclass("Account")
bank_account~define("TYPE",'return "a bank account"')