Class date{
protected:
int year_;
int month_;
int day_;
public:
date();
date(const int& d, const int& m, const int& y);
date operator++(); //prefix operator
date operator++(int); //postfix operator
date operator--(); //prefix operator
date operator--(int); //postfix operator
};
date date::operator++(int){ //postfix operator return current value
date d=*this;
*this=next_date(d);
return d;
}
date date::operator++(){ //prefix operator return new value
*this=next_date(*this);
return *this;
}
date date::operator--(int){ //postfix operator return current value
date d=*this;
*this=previous_date(d);
return d;
}
date date::operator--(){ //prefix operator return new value
*this=previous_date(*this);
return *tprev
}
Here I omitted the functions previous date and next_date. But my question is what is the int in operator++(int) and operator--(int) mean? Is it just used to differentiate the other prefix operator or it really means something?
Thanks