Mattias Gaertner schrieb:
On Tue, 17 Apr 2012 19:46:08 +0200
Sven Barth <[email protected]> wrote:

[...]
Well... class helpers are at least an officially supported hackish approach unlike other forms of making a protected member visible.

I wonder what protected is still good for when you can use class helpers
to access protected members from anywhere.

The VCL design often hides properties (as protected), which should be accessible by user code, under certain circumstances. The classic workaround for such cases was the declaration of a dummy class, derived from an existing VCL class, what allows to access the protected members of the *base* class in that unit. Such situations now can be handled by reusable class helpers, with better encapsulation of the added features; they can allow access to *selected* protected members of the class, still hiding other protected members.

The downside of the Delphi model: it's hard to determine, which class helper is *currently* used in some code, because the unit order in the uses clause(s) is involved hereby. That's why I would add my class helpers to every unit in which they are used, to eliminate that uncertainty.

DoDi


--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to