#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;
class A
{
public:
int first,second;
A(int a, int b)
{
first = a;
second = b;
}
A()
{
first = 0;
second = 0;
}
A operator ++(int k)//后缀
{
A tmp(first, second);
first++;
second++;
return tmp;
}
A& operator ++()//前缀
{
first++;
second++;
return *this;
}
};
int main()
{
A a(7, 8);
cout << a.first << ' ' << a.second << endl;
a++;
++a;
return 0;
}
标签:4.7,++,运算符,int,second,自减,include,first
From: https://www.cnblogs.com/tangxibomb/p/17141290.html