关于返回类对象时的匿名对象的问题
class TestClass1{public: TestClass1() { cout<<"default constructor"<<endl; } TestClass1(int i) { cout<<"specified constructor"<<endl; } ~TestClass1() { cout<<"~TestClass1()"<<endl; } TestClass1(const TestClass1& t) { cout<<"copy-con"<<endl; } TestClass1& operator = (const TestClass1 &t) { if( &t == this ) return *this; cout<<"operator = "<<endl; return *this; }};TestClass1 function1(TestClass1 tc){ return tc;}void main(){ TestClass1 tc1; TestClass1 tc2=function1(tc1); cout<<"=================="<<endl; TestClass1 tc3; tc3 = function1(tc1);}