C++之自增、自减运算符的前缀、后缀运算符区别(5)---《More Effective C++》
C++继承了C语言的自增、自减运算符,由于C++的面向对象机制,所以针对C++中自定义类型我们需要重载其自增、自减运算符,需要注意其中的区别,下面举例说明:#include <iostream>
#include <string>
using namespace std;
class MyInt{
private:
int i;
public:
MyInt(){ }
M
原创
2017-08-31 10:49:29 ·
1191 阅读 ·
0 评论