> A simple yes/no question.
> 
> Should I cast an object to it's defined type before I Free it?
> ie. MyObject(ListBox.Items.Objects[0]).Free
>    or simply ListBox.Items.Objects[0].Free will do?

No.

***** (Optional non yes/no portion)

destructor Destroy() in TObject (the base class of every
object) is virtual.    Free calls this destructor - so any 
derived class overrides will get called with the cast you
describe.

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

-ns

---------------------------------------------------------------------------
    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