Friday, June 17, 2011


Polymorphism means different types of data can be handled with an uniform interface. The interface is the same, but the implementation can be different. There are three types of polymorphism:
  1. ad-hoc polymorphism: functions with same name but different parameter lists (i.e. function overloading).
  2. parametric polymorphism: generic data types, for example, template in C++,  which just provides a general data type.
  3. subtype polymorphism: different class objects (classes should have inheritance relations) can be applied with the same interfaces. For example, the virtual functions in C++.

No comments:

Post a Comment