mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-13 10:49:17 +02:00
operators in different units problem
This commit is contained in:
parent
f6a7349bb4
commit
dc58ddc5a4
15
tests/test/testop.pp
Normal file
15
tests/test/testop.pp
Normal file
@ -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
tests/test/testop1.pp
Normal file
20
tests/test/testop1.pp
Normal file
@ -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
tests/test/testop2.pp
Normal file
20
tests/test/testop2.pp
Normal file
@ -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.
|
Loading…
Reference in New Issue
Block a user