I am trying to get advanceDate to change the date of an "appointment" object it just adds 1 to the day integer.
when I call the print function inside the advanceDate function. It prints the modified value I am looking for. But after it returns the object and I call print again inside my Main, the original value is back? I'm sure this is something simple I am overlooking or forgetting any ideas?
void main()
{
appointment newApp(123,"Andrew",7,12,1987);
newApp.print(cout,1);
advanceDate(newApp,5);
newApp.print(cout,1);
system("pause");
return;
}
appointment advanceDate( const appointment & e, int numberOfDays)
{
appointment newApp2(e);
for(int x = 0; x < numberOfDays; x++)
{
newApp2.incrementDate();
}
newApp2.print(cout,1);
return newApp2;
}