The purpose of this lab is to expand on Lab 6 by adding the copy constructor and assignment operator to the employee objects.
Take your solution for Lab 6 or the posted solution (lab6.cpp) and copy it to lab7.cpp. In lab7.cpp, you are going to add a copy constructor and assignment operator to both the parent class (Employee) and the child class (hourlyEmployee).
The parent copy constructor and assignment operator will copy the name and SSN from the source object into the current object.
The child copy constructor will invoke the parent copy constructor to set the name and SSN. It will then copy the rate and hours over to the current object. The child's assignment operator will invoke the parent's assignment operator using the following syntax:
Employee::operator=(source);After that, it will copy the source's rate and hours over to the current object.
Note: You can also modify setEmployee() in the hourlyEmployee class to invoke the parent's form of setEmployee() by doing the following:
Employee::setEmployee();
Update your main function in lab7.cpp to the following:
int main() { Employee a; hourlyEmployee b, c; cout << "Entering data for the Employee class object...\n"; a.setEmployee(); cout << endl; cout << "The paycheck for the Employee class object is:\n"; a.printPaycheck(); cout << endl; cout << "Entering data for the hourlyEmployee class object...\n"; b.setEmployee(); cout << endl; cout << "The paycheck for the hourlyEmployee class object is:\n"; b.printPaycheck(); cout << endl; c = b; cout << "After assigning b to c, c has the following paycheck:\n"; c.printPaycheck(); cout << endl; hourlyEmployee clone(b); cout << "The clone of the hourlyEmployee has the following paycheck:\n"; clone.printPaycheck(); cout << endl; Employee c2(b); cout << "The sliced clone (Employee type) has the following paycheck:\n"; c2.printPaycheck(); cout << endl; return 0; }Email your completed lab7.cpp to me.