tw1223.pp 548 B

12345678910111213141516171819202122232425262728
  1. { Source provided for Free Pascal Bug Report 1223 }
  2. { Submitted by "Denis Yarkovoy" on 2000-11-03 }
  3. { e-mail: [email protected] }
  4. Type
  5. TPoint = record
  6. X, Y : integer;
  7. end;
  8. operator + (const p1, p2:TPoint) p : TPoint;
  9. begin
  10. p.X:=p1.X+p2.X;
  11. p.Y:=p1.Y+p2.Y;
  12. end;
  13. var d,d1:TPoint;
  14. begin
  15. d.x:=5;d.y:=34;
  16. d1.x:=6;d1.y:=-50;
  17. d:=d+d1;
  18. if (d.x<>11) or (d.y<>-16) then
  19. begin
  20. Writeln('Error is operator overloading');
  21. Halt(1);
  22. end
  23. else
  24. Writeln('Operator overloading works correctly');
  25. end.