summaryrefslogtreecommitdiff
path: root/fpcsrc/tests/webtbf/tw6922.pp
blob: c02fc2a39b8306200edf28655ff26f3188c961d0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
{ %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.