I am writing a time of day project and part of it is supposed to overload the + operator to add two time objects and return another object as the result. I can't seem to get this down. We have to use a test bed to test it out.
This is what I have for the overload function
Time Time::operator +(const Time & that){
Time temp(*this);
*this =(hour, minute);
temp = add(that.hour, that.minute);
return temp;
}
This is the test I run
Time t24 = (1,1);
Time t25 = (1,1);
t24+t25;
if(t24.getMinute()== 2 &&
t24.getHour()== 2 )
good++;
else {
Memo1->AppendText(wxString("+ operator fails object. \n"));
bad++;
}