toperator2.pp 408 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. unit toperator2;
  2. interface
  3. type
  4. op1 = record
  5. x,y : longint;
  6. end;
  7. operator + (const a,b : op1) c : op1;
  8. implementation
  9. uses
  10. toperator3;
  11. operator + (const a,b : op1) c : op1;
  12. begin
  13. c.x:=a.x+b.x;
  14. c.y:=a.y+b.y;
  15. end;
  16. procedure test_op2;
  17. var
  18. a,b,c : op2;
  19. begin
  20. a.x:=44;
  21. a.y:=67;
  22. b.x:=-34;
  23. b.y:=-57;
  24. c:=a+b;
  25. if (c.x<>10) or (c.y<>10) then
  26. Halt(1);
  27. end;
  28. begin
  29. test_op2;
  30. end.