> On Apr 23, 2019, at 6:25 PM, Sven Barth via fpc-pascal
> <[email protected]> wrote:
>
> A helper can not access its extended type in its interface, only in its
> implementation (and yes, this gets important if published properties are
> involved, which a helper may declare as well).
> Use a getter as a workaround. If you use "inline" chances are high that it
> will be nearly equal code as if you used a direct access.
>
Still getting errors. What did I do wrong?
{$mode objfpc}
{$modeswitch advancedrecords}
program test;
type
TRec = record
x: integer;
function GetX: integer;
procedure SetX (newValue: integer);
end;
function TRec.GetX: integer;
begin
result := x;
end;
procedure TRec.SetX (newValue: integer);
begin
x := newValue;
end;
type
THelper = record helper for TRec
property F: integer read GetX write SetX; // ERROR: Unknown class field or
method identifier "GetX"
end;
begin
end.
Regards,
Ryan Joseph
_______________________________________________
fpc-pascal maillist - [email protected]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal