i feel the need to comment on this :-)

> But you should be sure that any objects you derive override
> the virtual destructor Destroy so they'll get called
> for your objects as well

unless i misunderstand what you're saying, that's not quite right..

if i do: 

constructor TmyPanel.Create(AOwner: TComponent);
begin
 inherited;
 FmyButton:=TButton.Create(self);

then you dont need to override the destructor. the TComponent.Destroy
override takes care of destroying anything that you own 
(i.e. .create(self));

but if you do:

constructor TmyPanel.Create(AOwner: TComponent);
begin
 inherited;
 FmyList:=TStringList.Create;

then you will need a:

destructor TComponent.Destroy;
begin
 FmyList.Free;
 inherited;

else you will get a memory leak.

hope that clears things up a bit :-)


__________________________________________________
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/
---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/

Reply via email to