|
class PACKAGE TMineSwp : public TWinControl
{
//중간생략
TTimer* timer;
//중간생략
};
__fastcall TMineSwp::TMineSwp(TComponent* Owner)
: TWinControl(Owner)
{
timer = new TTimer(this);
timer->Enabled = false; timer->Interval = 200; timer->OnTimer = TimerTimer;
}
__fastcall TMineSwp::~TMineSwp()
{
delete timer; // Is this code required?
}
위에서 timer의 owner가 this가 되도록 생성했는데, 이것은 this가 소멸될 때 timer도 자동으로 소멸됨을 뜻합니다.
그렇다면,이때 소멸자에서 timer를 위와 같이 손수 delete해줄 필요성이 있을까요?
|