Browse Source

operators in different units problem

pierre 25 years ago
parent
commit
dc58ddc5a4
3 changed files with 55 additions and 0 deletions
  1. 15 0
      tests/test/testop.pp
  2. 20 0
      tests/test/testop1.pp
  3. 20 0
      tests/test/testop2.pp

+ 15 - 0
tests/test/testop.pp

@@ -0,0 +1,15 @@
+uses
+ testop1,testop2;
+
+var
+  a,b,c : op1;
+  d,e,f : op2;
+
+begin
+  a.x:=67;a.y:=-45;
+  b.x:=89;b.y:=23;
+  c:=a+b;
+  e.x:=67;e.y:=-45;
+  f.x:=89;f.y:=23;
+  d:=e+f;
+end.

+ 20 - 0
tests/test/testop1.pp

@@ -0,0 +1,20 @@
+unit testop1;
+
+interface
+
+type
+  op1 = record
+    x,y : longint;
+  end;
+
+operator + (const a,b : op1) c : op1;
+
+implementation
+
+operator + (const a,b : op1) c : op1;
+begin
+  c.x:=a.x+b.x;
+  c.y:=a.y+b.y;
+end;
+
+end.

+ 20 - 0
tests/test/testop2.pp

@@ -0,0 +1,20 @@
+unit testop2;
+
+interface
+
+type
+  op2 = record
+    x,y : longint;
+  end;
+
+operator + (const a,b : op2) c : op2;
+
+implementation
+
+operator + (const a,b : op2) c : op2;
+begin
+  c.x:=a.x+b.x;
+  c.y:=a.y+b.y;
+end;
+
+end.