SE450: Types: Late Binding [34/47] |
The actual type of an object -- along with the object state -- determines message response.
Actual type of receiver cannot be determined statically!
Colored p3, r3; p3.getColor(); // prints "Cartesian" r3.getColor(); // prints "Polar"
The actual method is bound late (ie, determined at run-time).
This is implemented using virtual function tables (aka, vtables).