summaryrefslogtreecommitdiff
path: root/fpcsrc/tests/tbs/ub0222.pp
blob: f8ddc6f24b472b85c689fe95b9d0ee64de0e7c2d (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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
{ Old file: tbs0261a.pp }
{  }

unit ub0222;

{ test for operator overloading }
{ Copyright (c) 1999 Lourens Veen }
{ why doesn't this work? }

interface

type mythingy = record
       x, y : longint;
       c : byte;
       end;

     myotherthingy = record
       x, y : longint;
       d : byte;
       end;

     mythirdthingy = record
       x, y : longint;
       e : byte;
       end;

     mynewthingy = record
       x, y : longint;
       e,f : byte;
       end;

operator := (a : mythingy) r : myotherthingy;
operator := (a : mythingy) r : mythirdthingy;
operator = (b : myotherthingy;c : mythirdthingy) res : boolean;

implementation

operator := (a : mythingy) r : myotherthingy;
begin
  r.x := a.x;
  r.y := a.y;
  r.d := a.c;
end;

operator := (a : mythingy) r : mythirdthingy;
begin
  r.x := a.x;
  r.y := a.y;
  r.e := a.c;
end;

operator = (b : myotherthingy;c : mythirdthingy) res : boolean;
begin
  res:=(b.x=c.x) and (b.y=c.y) and (b.d=c.e);
end;

end.