所以我有这个代码是自己写的,但取自其他示例代码......
class A{
friend std::ostream& operator<< (std::ostream& out, A& a);
// Constructors, destructor, and variables have been declared
// and initialized and all good.
}
std::ostream& operator<< (std::ostream& out, A& a){
out << " this gets written " << endl; // it doesn't get executed
return out;
}
int main(){
A *_a = new A();
return 0;
}
好吧,这只是不在控制台中打印" this gets written "