[fpc-pascal] Usage of FieldAddress

Sven Barth pascaldragon at googlemail.com
Sun Apr 4 21:07:06 CEST 2021


Am 04.04.2021 um 20:15 schrieb Ryan Joseph via fpc-pascal:
>
>> On Apr 4, 2021, at 12:10 PM, Sven Barth via fpc-pascal <fpc-pascal at lists.freepascal.org> wrote:
>>
>> FieldAddress only works on published fields. Just like MethodAddress only works on published methods.
>>
>> For private fields extended RTTI is required which is not yet implemented.
> I don't understand this at all I guess. I thought the properties made them published and I get a "Symbol cannot be published, can be only a class" if I put the field itself in the published section.
>
> Just trying to do this:
>
> PInteger(theClass.FieldAddress('foo'))^ := 10;

Only classes or interfaces are supported as published *fields*.

And the visibility of the *property* does not change the visibility of 
the *field*, after all the property could be provided by a method.

Regards,
Sven


More information about the fpc-pascal mailing list