We'd expect name, number and letter passed to ProductionWorker would eventually be stored in the Employee part of ProductionWorker. But it isn't.
You'd do this by using the Employer contructor within the ProductionWorker constructor. Now, C++ is a strongly typed language, so why isn't the type system stopping you from making a "type" mistake? Because Employee is a default constructor, and the compiler is using that within ProductionWorker.
So first, remove the default constructor from Employee.
Next, initialize the Employee part of ProductionWorker.
1 2 3 4 5 6
|
ProductionWorker::ProductionWorker(string newName, int newNumber, char newLetter, int newShift, double newHourlyPayRate) :
Employee(newName, newNumber, newLetter),
shift(newShift),
hourlyPayRate(newHourlyPayRate)
{
}
|
Next, although you haven't hit any problems yet, object in C++
always use virtual functions. Also, the base class must have a virtual destructor. If you don't do this, the object oriented stuff doesn't work properly for a variety of reasons. So, make the methods virtual, and add a destructor to Employee.