关于函数返回对象类型的一个简单的问题
看例子:
#include <iostream>using namespace std;class Test {public: Test() { cout<<"Test()"<<endl; } Test(const Test &t) { cout<<"Test(Test)"<<endl; } ~Test() { cout<<"~Test()"<<endl; } Test &operator=(const Test &t) { cout<<"Test(=)"<<endl; return *this; }};Test func() { return Test();}int main() { Test h = func(); return 0;}