下面程序对一维坐标点类Point进行运算符重载 #include class Point { public: Point(int val) {x=val;} Point & operator++() {x++;return *this;}

lk2025-05-19  3

题目:下面程序对一维坐标点类Point进行运算符重载 #include class Point { public: Point(int val) {x=val;} Point & operator++() {x++;return *this;} Point operator++(int) {Point old=*this;++(*this);return old;} int GetX() const {return x;} private: int x; }; void main() { Point a(10); cout<<(++A..GetX(); cout< } 编译和运行情况是( )。

A. 运行时输出1011

B. 运行时输出1111

C. 运行时输出1112

D. 编译有错

答案:评论后可见此内容

本站资源均来自互联网,侵权请联系站长删除

最新回复(0)
公众号图片
🔥推荐

推荐使用我们的公众号搜索题目,题目更全,检索更方便。支持语音、图片、文字等多种搜索方式。