If you call a method in a class that was defined in some parent, the compiler has a simple algorithm to find the definition: it searches up the parent/child hierarchy. |
Class: |
method A |
Definition of method |
is given in parent |
Class: |
Class: |
Class: |
Class: |
Object2 |
Object1 |
Object1 creates object2 |
and calls object2.A |