#include
class Point
{
private:
int x;
int y;
public:
Point (int a,int b){x=a;y=b;}
Point &operator ++(int); //后置++
Point &operator --(int); //后置--
Point &operator ++(); //前置++
Point &operator --(); //前置--
void print();
};
Point &Point::operator++(int)
{return Point(x++,y++);}
Point &Point::operator--(int)
{return Point(x--,y--);}
Point &Point::operator++()
{return Point(++x,++y);}
Point &Point::operator--()
{return Point(--x,--y);}
void Point::print()
{cout<<"x="<
main()
{ Point a1(2,3);
a1++;
a1.print();
}
好了吧