Polymorphism

Measurable x;
x = new BankAccount(10000);
x = new Coin(0.1, "dime");

double m = x.getMeasure();


Why is it impossible to construct a Measurable object?

   Answer: Measurable is an interface. Interfaces have no fields
   and no method implementations.


Why can you nevertheless declare a variable whose type is Measurable?

   Answer: That variable never refers to a Measurable object. It
   refers to an object of some class – a class that implements the
   Measurable interface.


What do overloading and polymorphism have in common? Where do they differ?

   Answer: Both describe a situation where one method name can
   denote multiple methods. However, overloading is resolved
   early by the compiler, by looking at the types of the parameter
   variables. Polymorphism is resolved late, by looking at the type
   of the implicit parameter object just before making the call.