c++基础问题,运算符重载



```c++
#include<iostream>
using namespace std;

class Myint
{
public:
    friend ostream&operator<<(ostream &cout, Myint mint);
    Myint()
    {
        m_H = 8;
    }
    //前置重载
    Myint& operator--()
    {
        --m_H;
        return*this;
    }
    //后置重载
    Myint operator--(int)
    {
        Myint temp=*this;
        m_H--;
        return temp;
    }

private:
    int m_H;
};
ostream&operator<<(ostream &cout, Myint min)
{
    cout << min.m_H;
    return cout;
}
void test01()
{
    Myint mint;
    cout <<(mint--)--<< endl;//为什么我的结果是(8,7,6)不应该是(8,6,5)吗,两次自减只用了一次,为什么
    cout << mint-- << endl;
    cout << mint-- << endl;

}
int main()
{
    test01();
    system("pause");
    return 0;
}

```

你后置重载25行那里返回的是一个新的对象,所以有一次--操作是对那个新对象。39行你原始的mint其实就是减了一次