I have a class called ProductionWorker that inherits from the Employee class. ProductionWorker started out as just a .h file with inline methods but now I have added a .cpp file called ProductionWorker.cpp by right clicking Source Files and doing Add..->New Item
I added these functions to the the .cpp file and commented them out of the header file. They worked fine when they were in the .h file but now I getting lots of these errors
1 2 3
1>...exception_project\productionworker.h(50): error C3861: 'checkPayRate': identifier not found
1>
...exception_project\productionworker.h(51): error C3861: 'checkShift': identifier not found
Also getting stuff like this
productionworker.cpp(15): error C2039: 'checkPayRate' : is not a member of 'ProductionWorker'
The highlighting in the .cpp file is weird too.
For this, only void and Worker is highlighted in blue. The rest is black
void ProductionWorker::checkShift()
And for this, only void and rker is highlighted in blue. The rest is black void ProductionWorker::checkPayRate()
#include "Employee.h"
#include "ProductionWorker.h"
//validates the shift member
void ProductionWorker::checkShift()
{
//shift can only be 1 for day shift or 2 for night shift
if (shift < 1 || shift > 2)
{
throw InvalidShift();
}
}
//validates the payRate member
void ProductionWorker::checkPayRate()
{
if (payRate < 0)
{
throw InvalidPayrate();
}
}