https://www.freepascal.org/docs-html/ref/refse35.html

Strict Protected
    Is the same as Protected, except that the members of a Protected
    section are also accessible to other classes implemented in the
    same unit. Strict protected members are only visible to descendent
classes, not to other classes in the same unit.


In the below

TSubFoo can see the strict proctected TTest.
So therefore TSubFoo does not count as "not to other classes in the same unit."
Well, it is another class, but it is within the class TFoo.

TSubBar is also another class, but it is within TBar. And for TBar we have "only visible to descendent classes" => TBar should see TTest.
And since TSubBar is in TBar?

So the below code have that error, or is it a bug?
An if it should, what is the correct exact description of "Strict protected"?


program Project1;
type
  TFoo = class
  strict protected type
    TTest = record end;
  private type
    TSubFoo = class
      a: TTest;
    end;
  end;

  TBar = class(TFoo)
  private type
    TSubBar = class
      a: TTest;  // project1.lpr(15,10) Error: Identifier not found "TTest"
    end;
  end;

begin
end.
_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply via email to