mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-11-02 04:49:43 +01:00
of protected members called from a named class in a child class
that also has the visibility for those protected members
git-svn-id: trunk@4384 -
36 lines
452 B
ObjectPascal
36 lines
452 B
ObjectPascal
{ %fail }
|
|
{$ifdef fpc}{$mode objfpc}{$H+}{$endif}
|
|
|
|
uses uw6922;
|
|
|
|
type
|
|
|
|
{ TC }
|
|
|
|
TC=class(TA)
|
|
public
|
|
procedure Test;
|
|
end;
|
|
|
|
{ TC }
|
|
|
|
procedure TC.Test;
|
|
var
|
|
B: TB;
|
|
begin
|
|
T := 'Test1'; // allowed, because it is a descendant
|
|
B := TB.Create;
|
|
B.T := 'Test2'; // should not be allowed
|
|
writeln(B.T);
|
|
B.Free;
|
|
end;
|
|
|
|
var
|
|
c: TC;
|
|
begin
|
|
c := TC.Create;
|
|
c.T := 'Test3'; // allowed, because it is in the same 'unit'
|
|
c.Test;
|
|
c.Free;
|
|
end.
|