代码如下:
-----point.h
class Point
{
public:
Point();
Point(float x, float y);
~Point();
Point operator ++();
Point operator --();
private:
float x, y;
}
-----point.cpp
Point Point::operator ++()
{
this->x = this->x + 1;
this->y = this->y + 1;
return *this;
}
Point Point::operator --()
{
this->x = this->x - 1;
this->y = this->y - 1;
return *this;
}