[fpc-pascal] strict private construct

Mattias Gaertner nc-gaertnma at netcologne.de
Fri Apr 12 13:40:56 CEST 2019


On Fri, 12 Apr 2019 12:23:15 +0100
Graeme Geldenhuys <mailinglists at geldenhuys.co.uk> wrote:

> Hi,
> 
> What exactly is the point of "strict private"? I believe FPC supports
> it too, after Delphi added it. It makes absolutely no senses to me.
> From the name and original intent, it means it is "really really
> private" even in the same unit.

Yes.

 
> Yet you do something like this... and you have access to the strict
> private fields or methods. Go figure!
> 
> 
>   //we need this helper to access some strict private fields
>   TButtonStyleHookHelper = class Helper for TButtonStyleHook
>   protected
>    function DropDown: Boolean;
>   end;
> 
> 
> { TButtonStyleHookHelper }
> 
> function TButtonStyleHookHelper.DropDown: Boolean;
> begin
>   Result:=Self.FDropDown;
> end;

I get:
test1.pas(26,8) Error: identifier idents no member "FDropDown"

Please post a complete example.

Helpers are broken in several ways, but it seems this is not one of
them.

Mattias



More information about the fpc-pascal mailing list