How to access a private field from a class helper in Delphi 10.1 Berlin?

前端 未结 3 646
我寻月下人不归
我寻月下人不归 2020-12-09 20:07

I would like to use Gabriel Corneanu\'s jpegex, a class helper for jpeg.TJPEGImage. Reading this and this I\'ve learned that beyond Delphi Seattle you cannot access private

3条回答
  •  心在旅途
    2020-12-09 20:30

    Today I found a neat way around this bug using the with statement.

    function TValueHelper.GetAsInteger: Integer;
    begin
      with Self do begin
        Result := FData.FAsSLong;
      end;
    end;
    

    Besides that Embarcadero did a nice job building walls to protect the private parts and that's probably why they named it 10.1 Berlin.

提交回复
热议问题