Lab 7 - More Inheritance

The purpose of this lab is to add the copy constructor, assignment operator and destructor to the Employee class and its children from Lab 6. You may use either your solution for Lab 6 or the official solution.

For the copy constructor, use the provided copy constructor in hourlyEmployee as a template for the copy constructor in salariedEmployee. Make sure to invoke the parent copy constructor then copy the child-specific features.

For the destructor, add a destructor to Employee (the parent class) that just prints out to the screen "Employee destructor called". Likewise, add destructors to hourlyEmployee and salariedEmployee that print a similar message to the screen, but using the class name instead of Employee (e.g. "hourlyEmployee destructor called").

For the assignment operator, add an assignment operator to Employee that copies the name, SSN and total pay. Add an assignment operator to hourlyEmployee that invokes the parent assignment operator then copies the hours and rate. Add an assignment operator to salariedEmployee that invokes the parent assignment operator then copies the salary and weeks.

Replace main.cpp for lab6 with lab7main.cpp. This main function tests the assignment operator and copy constructor. It also shows you what happens when you assign a child object into a parent pointer, which will be the basis for the next topic in inheritance: polymorphism. We'll discuss polymorphism more on Wednesday.

Email me your updated employee.h and employee.cpp files.