为什么构造一次却析构两次
为什么构造一次,却析构2次,加上拷贝构造函数,却又是一次构造,一次析构
#include<iostream>
using namespace std;
class T2
{
public:
T2(int a=0)
{
cout<<"constructor T"<<endl;
}
/*T2(T2 &a)
{
cout<<"copy constructor"<<endl;
}
*/
~T2()
{
cout<<"destroy"<<endl;
}
};
void f(T2 a)
{
}
int main()
{
f(T2());
return 0;
}