#include <iostream>
using namespace std;
class NumDays
{
private:
double hours;
double days;
public:
NumDays(double h=0)
{
hours=h;
days=h/8.0;
}
void setHours(double h)
{
hours=h;
days=h/8.0;
}
double getHours() const
{
return hours;
}
void setDays(double d)
{
hours=d*8.0;
days=d;
}
double getDays() const
{
return days;
}
NumDays operator + (NumDays &);
NumDays operator ++();
NumDays operator ++(int);
};
int main()
{
NumDays dayOne(17),dayTwo(27), dayThree, dayFour, dayFive;
cout<< "Day One: "<< dayOne.getDays() << endl;
cout<< "Day Two: "<< dayTwo.getDays() << endl;
dayThree = dayOne +dayTwo;
cout<< "Day Three(in days): "<< dayThree.getDays() << endl;
cout<< "Day Three(in hours): "<< dayThree.getHours() << endl;
cout<< endl;
dayFour=dayThree ++;
cout<< "Day Three(in days): "<< dayThree.getDays() << endl;
cout<< "Day Three(in hours): "<< dayThree.getHours() << endl;
cout<< "Day Four(in days): "<< dayFour.getDays() << endl;
cout<< "Day Four(in hours): "<< dayFour.getHours() << endl;
cout<< endl;
dayFive= ++dayThree;
cout<< "Day Three(in days): "<< dayThree.getDays() << endl;
cout<< "Day Three(in hours): "<< dayThree.getHours() << endl;
cout<< "Day Five(in days): "<< dayFive.getDays() << endl;
cout<< "Day Five(in hours): "<< dayFive.getHours() << endl;
system("pause");
return 0;
}
Here is the error
Error 1 error LNK2019: unresolved external symbol "public: class NumDays __thiscall NumDays::operator++(void)" (??ENumDays@@QAE?AV0@XZ) referenced in function _main
Error 2 error LNK2019: unresolved external symbol "public: class NumDays __thiscall NumDays::operator++(int)" (??ENumDays@@QAE?AV0@H@Z) referenced in function _main
Error 3 error LNK2019: unresolved external symbol "public: class NumDays __thiscall NumDays::operator+(class NumDays &)" (??HNumDays@@QAE?AV0@AAV0@@Z) referenced in function _main
Error 4 fatal error LNK1120: 3 unresolved externals