12.6.5. Demonstrating Polymorphic Processing
To test our
Employee hierarchy, the program in Fig. 12.17 creates an object of each of the three concrete classes
BasePlusCommissionEmployee. The program manipulates these objects, first with static binding, then polymorphically, using a
Employee pointers. Lines 22–27 create objects of each of the three concrete
Employee derived classes. Lines 32–38 output each
Employee’s information and earnings. Each member-function invocation in lines 32–37 is an example of static binding—at compile time, because we are using name handles (not pointers or references that could be set at execution time), the compiler can identify each object’s type to determine which ...