ugenfunc19.pp 479 B

12345678910111213141516171819202122232425262728293031323334353637
  1. unit ugenfunc19;
  2. {$mode objfpc}{$H+}
  3. interface
  4. type
  5. TTest = class
  6. class function Test: LongInt; static;
  7. end;
  8. TTestHelper = class helper for TTest
  9. class function Test: LongInt; static;
  10. end;
  11. generic function DoTest<T: TTest>: LongInt;
  12. implementation
  13. class function TTest.Test: LongInt;
  14. begin
  15. Result := 1;
  16. end;
  17. class function TTestHelper.Test: LongInt;
  18. begin
  19. Result := 2;
  20. end;
  21. generic function DoTest<T>: LongInt;
  22. begin
  23. Result := T.Test;
  24. end;
  25. end.