On Nov 29, 2025 at 8:40:33 PM, Thomas Kurz via fpc-pascal <
[email protected]> wrote:

> Can't you use a type helper to access the fields only locally in other
> classes? Unfortunately this works only for `protected` and not for
> `private` fields, but if it's your own class, maybe you'd like to give it a
> try.
>
> Btw: I would be great if type helpers could be given access to `private`
> fields, too!
>
>
Pretty sure no because the fields are private which is scoped to a single
file so if you declare the type helper in another unit you can't access the
field. That would be annoying to make helpers for all the types too.

I just tried actually and a property which read a public field from a class
in another unit failed too. That seems like a bug to me.
_______________________________________________
fpc-pascal maillist  -  [email protected]
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to