testbd.pp 512 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. type
  2. to1 = class
  3. destructor destroy;override;
  4. procedure beforedestruction;override;
  5. end;
  6. var
  7. i : longint;
  8. destructor to1.destroy;
  9. begin
  10. if i<>2000 then
  11. halt(1);
  12. i:=3000;
  13. inherited destroy;
  14. end;
  15. procedure to1.beforedestruction;
  16. begin
  17. if i<>1000 then
  18. halt(1);
  19. i:=2000;
  20. end;
  21. var
  22. o1 : to1;
  23. begin
  24. o1:=to1.create;
  25. i:=1000;
  26. o1.destroy;
  27. if i<>3000 then
  28. halt(1);
  29. writeln('ok');
  30. end.