Exercises, First Set

1.Rewrite the DrugStockItem class that you wrote in Chapter 9 as a derived class of DatedStockItem, using virtual functions to allow DrugStockItem objects to be used in place of StockItem objects or DatedStockItem objects, just as you can use DatedStockItem objects in place of StockItem objects.
2.Rewrite the Employee class that you wrote in Chapter 9 as three classes: a base Employee class, an Exempt class and an Hourly class. The latter two classes will be derived from the base class. The virtual CalculatePay member function for each of these derived classes should use the appropriate method of calculating the pay for each class so that an Exempt object or an Hourly object can be substituted for an Employee class object. ...

Get C++: A Dialog Programming with the C++ Standard Library 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.