twith.pp 291 B

123456789101112131415161718192021222324252627
  1. program twith;
  2. {$mode delphi}
  3. type
  4. twithbase = class
  5. end;
  6. twithchild = class(twithbase)
  7. procedure test; virtual;
  8. end;
  9. procedure twithchild.test;
  10. begin
  11. end;
  12. function func: twithbase;
  13. begin
  14. result:=twithchild.create;
  15. end;
  16. begin
  17. with twithchild(func) do
  18. test;
  19. end.