O'Reilly logo

C++11 for Programmers, Second Edition by Harvey M. Deitel, Abbey Deitel, Paul J. Deitel

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

11.3.1. Creating and Using a CommissionEmployee Class

Let’s examine CommissionEmployee’s class definition (Figs. 11.411.5). The CommissionEmployee header (Fig. 11.4) specifies class CommissionEmployee’s public services, which include a constructor (lines 11–12) and member functions earnings (line 29) and print (line 30). Lines 14–27 declare public get and set functions that manipulate the class’s data members (declared in lines 32–36) firstName, lastName, socialSecurityNumber, grossSales and commissionRate. Member functions setGrossSales (defined in lines 57–63 of Fig. 11.5) and setCommissionRate (defined in lines 72–78 of Fig. 11.5), for example, validate their arguments before assigning the values to data members grossSales and commissionRate ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required