[fpc-devel] TCustomApplication's parent class?

Vincent Snijders vsnijders at quicknet.nl
Sat Apr 26 10:52:49 CEST 2008


Graeme Geldenhuys schreef:
> Hi,
> 
> Why does TCustomApplication derive from TComponent instead of TObject?
> What is the reason behind this? Is there any benefits unknown to me?
> Surely we never need to persist the Appplication class. And it it's
> because we wanted RTTI support, again we could have enabled that for a
> TObject descendant with {$M+} compiler directives.
> 
> 
> TCustomApplication = Class(TComponent)
> ....
> end;

It most probably is not unknown to you: the most important benefit of 
being TComponent is that you can be owner of other components, so that 
eases memory management. The Application can become responsible for 
freeing the components it owns.

Vincent



More information about the fpc-devel mailing list