Contents
Page-10
Prev
Next
Page+10
Index
Dynamic Method Lookup
Each class associates a selector with the method
that implements the selector for that class:
((area circle_area)
(draw circle_draw) ...)
A typical dynamic method lookup procedure is:
- Look for the selector in the class of the object to which the
message was sent.
- If it is not found, look in superclasses of the class.
The first method found in this search up the class tree
is the one that is used. This provides:
- shadowing: a more specific subclass method
over-rides a superclass method with the same name.
- inheritance: methods of a superclass are
inherited by its subclasses.