-1
我想释放在类销毁成员对象
class A
{
A() {} //Constructor
//Other Definitions go here
}
Class B
{
B(){} //Constructor
~B()
{
//what should I do to release the memory location of A's object
//Shall I call default destructor of A
}
private:
A objA;
}
无所事事是最好的。 – chris
它会自动释放,除非你用'new'动态分配它(在这种情况下,你需要''删除它)。 – Nbr44
A的析构函数会自动被调用。 –