关于等于重载操作符的问题
#include <iostream>
using namespace std;
class Test1
{
public:
Test1(int n) { cout<<"Created"<<endl; num = n; }
Test1& operator= ( const Test1& T )
{
cout<<"等于重载."<<endl;
this->num = T.num;
return *this;
}
public:
int num;
};
int main()
{
Test1 TTTT(1);
Test1 t1 = TTTT;
system("pause");
return 0;
}
****************************************************************************
输出是:
Created...
*******************问题*************
Test1 t1 = TTTT; 为什么这里不是调用 =重载了的操作符???