tclass1.pp 535 B

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