[fpc-pascal] Class helper properties

Anthony Walter sysrpl at gmail.com
Mon Feb 25 08:37:34 CET 2019


Ryan, I am guessing in the declaration you need to read or write from
methods on the helper only and not from fields or methods on the type you
are extending.

type
  TMyObject = class
  private
    FNum: Integer;
  public
    property Num1: Integer read FNum;
  end;

  TMyObjectHelper = class helper for TMyObject
  private
    function GetNum2: Integer;
  public
    property Num2: Integer read GetNum2;
  end;

implementation

function TMyObjectHelper,GetNum2: Integer;
begin
  Result := FNum;
end;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20190225/798f8fee/attachment.html>


More information about the fpc-pascal mailing list