操作员是否delete()
也销毁对象的所有子对象?还是我需要在删除父对象之前调用子对象的删除?
class equipment
{
public:
int model_id;
...
}
class player
{
public:
int x, y;
equipment * Equipment;
player(void) { Equipment = new equipment[2];};
~player(void) { delete [] Equipment; }
};
int main (....)
{
player = new Player;
...
...
delete Player;
}