The topic of polymorphism is given mystical status in some programming texts and is ignored in others, but it’s a simple, useful concept that the C++ language supports. According to the standard, a “polymorphic type” is a class type that has a virtual function. From the design perspective, a “polymorphic object” is an object with more than one type, and a “polymorphic base class” is a base class that is designed for use by polymorphic objects.
Consider a type of financial option,
AmOption, as shown in Figure 1.
Figure 1. Polymorphic leveraging in a financial option hierarchy. An American option has four types.