//递增运算符重载
#include
using namespace std;
class p
{
public:
int a;
int b;
};
p operator++(p& p1)
{
p temp;
temp.a = p1.a++;
temp.b = p1.b++;
return temp;
}
void z()
{
p p1;
p1.a = 10;
p1.b = 15;
operator++(p1); //自己写的递增运算符重载
cout << p1.a << endl;
cout << p1.b << endl;
}
int main()
{
z();
system(“pause”);
}