#include class Point { private: int _x; int _y; public: Point(int x, int y) : _x(x), _y(y) {} Point& operator++() { _x++; _y++; return *this; } Point operator++(int) { Point temp = *this; _x++; _y++; return temp; } Point& operator--() { _x--; _y--; return *this; } Point operator--(int) { Point temp = *this; _x--; _y--; return temp; } void display() { std::cout << "(" << _x << ", " << _y << ")"; } }; int main() { int x, y; std::cin >> x >> y; Point point(x, y); Point temp0 = point; temp0.display(); std::cout << std::endl; // 后置和前置“++”运算 Point temp1 = point++; temp1.display(); std::cout << std::endl; ++point; point.display(); std::cout << std::endl; // 后置和前置“--”运算 Point temp2 = point--; temp2.display(); std::cout << std::endl; --point; point.display(); std::cout << std::endl; return 0; }