[fpc-devel] private visibility question
Martin Frb
lazarus at mfriebe.de
Mon Sep 28 11:18:38 CEST 2026
If I have the below TFoo, and in ANOTHER unit I declare
var foo: TFoo
then I can access
foo.e := a1;
This works even though "a1" is private and not visible. But by being the
type for a public field (or method) it becomes available.
This is not true for
foo.b.abc;
Is that intentional?
unit Unit2;
{$mode ObjFPC}{$H+}
interface
uses SysUtils;
type
TFoo = class
private type
TEnum = (a1,a2);
TBar = class
protected
procedure abc; virtual ; abstract;
end;
public
b: TBar;
e: TEnum;
end;
implementation
end.
More information about the fpc-devel
mailing list