65,187
社区成员




#include <iostream>
using namespace std;
class A
{
public:
A()
{
cout << "constructor" << endl;
}
A(const A & B)
{
cout << "copy constructor" << endl;
}
~A()
{
cout << "Destroyer" << endl;
}
};
A f()
{
A a;
return a;
}
int main()
{
A b;
b = f();
A c=b;
return 0;
}
/*
constructor
constructor
copy constructor
Destroyer
Destroyer 这个析构函数是析构谁的,还有能不能用某个语句显示出是哪个
作用域内调用的这个构造/析构函数呢?
copy constructor
Destroyer
Destroyer
请按任意键继续. . .
*/