class test{public:test(){cout << "constructor with argument\n";}~test(){}test(test& t){cout << "copy constructor\n";}test&operator=(const test&e){cout << "assignment operator\n";return *this;}};int _tmain(int argc, _TCHAR* argv[]){test ort;test a(ort);test b = ort ;a = b;return 0;}

test(test t);
test ort;test a(ort); --> test.a(test t=ort)==test.a(test t(ort))-->test.a(test t(test t = ort))==test.a(test t(test t(ort)))-->test.a(test t(test t(test t=ort)))- ...
就这样会一直无限递归下去。
class test{public:test(){cout << "constructor with argument\n";}~test(){}test(test& t){cout << "copy constructor\n";}test&operator=(test e){cout << "assignment operator\n";return *this;}};int _tmain(int argc, _TCHAR* argv[]){test ort;test a(ort);test b = ort ;a = b;return 0;}

C++ 为什么拷贝构造函数参数必须为引用?赋值构造函数参数也必须为引用吗?
原文:http://www.cnblogs.com/chengkeke/p/5417362.html