`
#include<iostream>
using namespace std;
class MyInteger {
friend ostream& operator<<(ostream& out, MyInteger& myint);
public:
MyInteger() {
m_Num = 0;
}
//Front++
MyInteger& operator++() {
m_Num++;
return *this;
}
//Rear ++
MyInteger operator++(int) {
MyInteger temp = *this;
m_Num++;
return temp;
}
private:
int m_Num;
};
ostream& operator<<(ostream& out, MyInteger& myint) {
out << myint.m_Num;
return out;
}
void test01() {
MyInteger myInt;
cout << ++myInt << endl;
cout << myInt << endl;
}
void test02() {
MyInteger myInt;
cout << myInt++ << endl;
cout << myInt << endl;
}
int main() {
test01();
//test02();
system("pause");
return 0;
}
` When I reload cout, the alias of MyInteger is passed in. Why can't I output the ++ postposition that I overloaded at this time. The hint is that there is no "<<" operator that matches these operands.But when I do not pass in the alias, it can be output normally.I want to know what caused it.