The Power of PolymorphismPolymorphism, Greek for "many forms", means that you can hide many alternative implementations behind a common interface. In Java and other OO languages this is done by inheritance (either direct inheritance of classes or by interface based inheritance). Basically it means that you can switch in alternative strategies and hide (or in OO speak - encapsulate) the code that performs the operation behind a known and public API. This ability means that you can create 'loosely-coupled' applications that allow new strategies to be added with the minimum amount of disruption.
|