On 18 April 2012 23:36, Reimar Grabowski <[email protected]> wrote: > What does depending on the compiler mean? The compiler is obviously FPC. > If it is really true that you can access protected members in that way (like > Svens message suggests) I consider this a bug. > Like Mattias said, protected is of no real use in that case and we can just > declare all non private members public.
Framework and Component developers cannot foresee all possible use-cases. So they might have thought protected is fine. I have numerous cases where I had to use the "class helper hack" (before the class helper or friend class features was introduced into FPC or Delphi). This doesn't mean protected is of no use any more, or that all protected methods should now become public, but it is often the case where one method needs to be accessed. If you really want concrete examples, I can search my code for where I use the "class helper hack". -- Regards, - Graeme - _______________________________________________ fpGUI - a cross-platform Free Pascal GUI toolkit http://fpgui.sourceforge.net -- _______________________________________________ Lazarus mailing list [email protected] http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
