previous |
start |
next
Polymorphism
- Depends on the actual object.
- If x refers to a bank account, calls
BankAccount.getMeasure
- If x refers to a coin, calls
Coin.getMeasure
- Polymorphism (greek: many shapes): The type of the object
determines the method to call
- Called late binding. Resolved at runtime
- Different from overloading. Overloading is resolved by the
compiler.
previous |
start |
next