toperator3.pp 763 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. unit toperator3;
  2. interface
  3. type
  4. op2 = record
  5. x,y,z : longint;
  6. end;
  7. operator + (const a,b : op2) c : op2;
  8. implementation
  9. uses
  10. toperator2,toperator4;
  11. operator + (const a,b : op2) c : op2;
  12. begin
  13. c.x:=a.x+b.x;
  14. c.y:=a.y+b.y;
  15. end;
  16. procedure test_op3;
  17. var
  18. a,b,c : op3;
  19. begin
  20. a.x:=44.0;
  21. a.y:=67.0;
  22. b.x:=-34.0;
  23. b.y:=-57.0;
  24. c:=a+b;
  25. if (c.x<>10.0) or (c.y<>10.0) then
  26. Halt(1);
  27. end;
  28. procedure test_op2;
  29. var
  30. a,b,c : op2;
  31. begin
  32. a.x:=44;
  33. a.y:=67;
  34. b.x:=-34;
  35. b.y:=-57;
  36. c:=a+b;
  37. if (c.x<>10) or (c.y<>10) then
  38. Halt(1);
  39. end;
  40. procedure test_op1;
  41. var
  42. a,b,c : op1;
  43. begin
  44. a.x:=44;
  45. a.y:=67;
  46. b.x:=-34;
  47. b.y:=-57;
  48. c:=a+b;
  49. if (c.x<>10) or (c.y<>10) then
  50. Halt(1);
  51. end;
  52. begin
  53. test_op1;
  54. test_op2;
  55. test_op3;
  56. end.