myclass operator++()
myclass operator++(int)
myclass &operator++()
myclass &operator(int)
@XuuuMeng 的答案不对.因为, ++i 或者 ++一个(重载了前++)对象, 应当返回一个引用, 以满足链式运算.即:
int i = 0; std::cout << ++++i << std::endl; //允许 std::cout << i++++ << std::endl; //不允许,因为(i++)返回的是一个右值
这道题你会答吗?花几分钟告诉大家答案吧!
扫描二维码,关注牛客网
下载牛客APP,随时随地刷题