On 06.11.2011 21:28, Frank Church wrote:
If that is the case then a lot of Free Pascal and Delphi demos are
teaching bad practices because they make most members accessible
externally when there is no real reason to. I never thought about that
much because I just wanted to get my apps working rather than think
about proper OOP practices, especially in the case of UI objects like
forms, controls etc

If you talk about the fields that are for the controls in a form, than this is intended. TForm, TFrame and TDataModule are descendants of TPersistent which has the {$M} option enabled, thus the default visibility is "published" and then and only then these fields and methods are accessible through RTTI (*). This is e.g. needed if you want to use a file like a DFM/LFM which stores your layout information (the way the GUI in Delphi/Lazarus works).

(*) The extended RTTI of Delphi 2009 and newer allows more options regarding this.

Regards,
Sven
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to