Polymorphism
- Interface variable holds reference to object of a class that implements the interface
Measurable x;
x = new BankAccount(10000);
x = new Coin(0.1, "dime");
Note that the object to which x refers doesn't have type Measurable; the type of the object is some class that
implements the Measurable interface
- You can call any of the interface methods:
double m = x.getMeasure();
- Which method is called?