Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
The word polymorphism derives from ancient Greek, where poly means many and morph means form. In programming languages, polymorphism is the idea that values of different data types can be treated in the same way. Often, this is manifested via class inheritance, where classes in a hierarchy can have methods of the same name. When such a method is called on an object, the right code is executed at runtime depending on which class the object is an instance of. There are various ways of achieving polymorphic behavior, and inheritance is only one such way. The diagram in figure 4.1, taken from a paper published by Luca Cardelli in 1985 (http://lucacardelli.name/Papers/OnUnderstanding.pdf), shows a high-level classification of polymorphism.