Method Binding and Overriding

· Binding is the association between method and class.
· Information present in a subclass can override information inherited from a parent class.
· Most often, implementation of this approach takes the form of a method in a subclass having the same name as a method in the parent class, combined with a rule for how the search for a method to match a specific message is conducted.

Method Binding and Overriding


· With the class of the receiver the search for a method to invoke in response to a given message begins. The search is conducted in the parent class of this class if no appropriate method is found. The search continues up towards the parent class chain until either a method is found or the parent class chain is exhausted.
If methods with the same name can be found higher in the class hierarchy, the method executed is said to override the inherited behaviour.


EmoticonEmoticon