[fpc-devel] TCustomApplication's parent class?

Michael Van Canneyt michael at freepascal.org
Sat Apr 26 18:04:10 CEST 2008



On Sat, 26 Apr 2008, Graeme Geldenhuys wrote:

> 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 is the owner of TForm/TDataModule classes by default.

Other than that, you can create any component, and make sure it's freed 
correctly when the application terminates, by creating it with the global 
Application instance as the parent class. I often do this in custom code.

Michael.



More information about the fpc-devel mailing list