[fpc-devel] protected class section / documentation

Martin me at mfriebe.de
Wed Jan 7 19:47:33 CET 2026


According to https://www.freepascal.org/docs-html/ref/refse34.html

> Protected
>     Is the same as Private, except that the members of a Protected
>     section are also accessible to descendent types, even if they are
>     implemented in other modules. 

"to descendant types" => suggests, from within a descendant type (even 
if the descendant type is in a different unit).

But the example (working with 3.3.1) from 
https://gitlab.com/freepascal.org/lazarus/lazarus/-/issues/41987 shows 
that the protected method is accessible
*_through_* the descendant type.

I.e. from any code in the unit of the descendant type, even code outside 
the descendant type, if it goes "through" the descendant type.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20260107/ac21ac1f/attachment.htm>


More information about the fpc-devel mailing list