4.2.7. Changing the Search Order for Methods
The class object must be a superclass of the class defining the active
method, or, if you used
setMethod to define the
active method, the object's own class.
The class symbol is usually the special variable
SUPER
,
but it can be any
environment symbol
or variable name whose value is a valid class.
Suppose you create an Account class that is a subclass of the Object
class, define a TYPE method for the Account class, and create the Savings class
that is a subclass of Account. You could define a TYPE method for the Savings
class as follows:
This changes the search order so that the language processor searches for
the TYPE method first in the Account superclass (rather than in the Savings
subclass). When you create an instance of the Savings class
(
asav)
and send a TYPE message to
asav: