class MyData
{
public:
int m_a;
MyData()
{
m_a = 0;
}
MyData& operator++(int)
{
MyData* temp = this;
this->m_a++;
return *temp;
}
};
ostream& operator<<(ostream& cout, MyData d)
{
cout << d.m_a;
return cout;
}
int main()
{
MyData d;
cout << d++ << endl;
cout << d << endl;
}
这里最后的两个输出都是1,想知道是哪里出了问题