tb0405.pp 493 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. { %version=1.1 }
  2. {$ifdef fpc}{$mode objfpc}{$endif}
  3. var
  4. err : boolean;
  5. type
  6. tc1=class
  7. constructor Create;overload;
  8. end;
  9. tc2=class(tc1)
  10. constructor Create(l:longint=0);overload;
  11. end;
  12. constructor tc1.create;
  13. begin
  14. writeln('tc1.create()');
  15. end;
  16. constructor tc2.create(l:longint);
  17. begin
  18. writeln('tc2.create()');
  19. err:=false;
  20. end;
  21. var
  22. c : tc2;
  23. begin
  24. err:=true;
  25. c:=tc2.create();
  26. c.free;
  27. if err then
  28. begin
  29. writeln('Error!');
  30. halt(1);
  31. end;
  32. end.