summaryrefslogtreecommitdiff
path: root/tests/webtbs/tw0873a.pp
blob: 1d28f705047cf317147c2286ab87daaa5a94abef (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
36
37
38
{$mode objfpc}

// Compile it using the Delphi extensions
// directive.

type
    TObjectB = class
      private
        procedure SetValue(v: integer);
      public
        fx: integer;
        Constructor Create;
        Destructor Destroy;
        property x: integer read fx write SetValue;
    end;

var
    Obj: TObjectB;

Constructor TObjectB.Create;
begin
    fx := 0;
end;

Destructor TObjectB.Destroy;
begin
end;

procedure TObjectB.SetValue(v: integer);
begin
    fx := v + 2;
end;

begin
    writeln('This will be printed');
    Obj := TObjectB.Create;
    writeln('This won''t.');
end.