tw29367.pp 458 B

123456789101112131415161718192021222324252627282930
  1. program Project1;
  2. {$Mode objfpc}
  3. type
  4. TFoo = class
  5. constructor create; virtual;
  6. end;
  7. TBar = type TFoo;
  8. TBaz = class(TBar)
  9. constructor create; override;
  10. end;
  11. constructor TFoo.create;
  12. begin end;
  13. constructor TBaz.create;
  14. begin end;
  15. begin
  16. if not tbar.inheritsfrom(tfoo) then
  17. halt(1);
  18. if not tbaz.inheritsfrom(tbar) then
  19. halt(2);
  20. if tbar.classname<>'TBar' then
  21. halt(3);
  22. if tfoo.classname<>'TFoo' then
  23. halt(4);
  24. end.