... CommissionEmployee

The CommissionEmployee class (Figs. 12.1312.14) derives from Employee (Fig. 12.13, line 9). The member-function implementations in Fig. 12.14 include a constructor (lines 10–15) that takes a first name, last name, social security number, sales amount and commission rate; set functions (lines 18–24 and 30–36) to assign new values to data members grossSales and commissionRate, respectively; get functions (lines 27 and 39–41) that retrieve their values; function earnings (lines 44–46) to calculate a CommissionEmployee’s earnings; and function toString (lines 49–56) to output the employee’s type, namely, "commission employee: " and employee-specific information. The constructor passes the first name, last name and social security number ...

Get C++ How to Program, 10/e now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.