Your .h file and .cpp file must match each other. You're implementing the constructor just about fine (in .cpp file) but are missing the declaration for that constructor.
Declare these ( in .h file)
TimeOff(); // this is the default constructor
TimeOff(string n, int empid, double maxSick, double sTaken, double maxVac,
double vTaken, double maxUnpd, double uTaken); // this is the constructor which takes parameters
And implement them like this ( using the constructor list )
TimeOff::TimeOff() :
name(""), id(0), maxSickdays(0), sickTaken(0), maxVacation(0), vacTaken(0), maxUnpaid(0), unpaidTaken(0)
{}
// this is the implementation for the default constructor
TimeOff::TimeOff(string n, int empid, double maxSick, double sTaken, double maxVac,
double vTaken, double maxUnpd, double uTaken) :
name(n) , id(empid), maxSickdays(maxSick), sickTaken(sTaken), maxVacation(maxVac), vacTaken(vTaken), maxUnpaid(maxUnpd), unpaidTaken(uTaken)
{}
// this is the implementation for the constructor that takes parameters
Btw, if there is no default constructor available ( constructor with no parameters ), a compiler will generate one automatically.
Topi Ojala
Junior Poster in Training
66 posts since May 2009
Reputation Points: 13
Solved Threads: 20