testac.pp 502 B

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