[Lazarus] How to access private field in FPC 2.7.1? ("class helper?")

silvioprog silvioprog at gmail.com
Fri Dec 23 20:04:08 CET 2011


Hi,

I tried to access the FScanner field from the TJSONParser, but without
sucess. x(

My test:

[code]
  { TJSONParserHelper }

  TJSONParserHelper = class helper for TJSONParser
  private
    function GetScanner: TJSONParser;
  public
    property Scanner: TJSONParser read GetScanner;
  end;

implementation

{ TJSONParserHelper }

function TJSONParserHelper.GetScanner: TJSONParser;
begin
  Result := Self.FScanner;
end;
[/code]

The error:

Error: identifier idents no member "FScanner".

So, FPC 2.7.1 support this sintaxe?:
http://stackoverflow.com/questions/8330003/access-a-strict-protected-property-of-a-delphi-class

In FPC 2.4.4 I use only:

  TJSONParserHelper = class(TJSONParser)
  public
    property Scanner: TJSONParser read FScanner;
  end;

Thanks.

-- 
Silvio Clécio
====================================
Site - <silvioprog.com.br>
LazSolutions - <code.google.com/p/lazsolutions>
====================================




More information about the Lazarus mailing list