tgeneric14.pp 372 B

123456789101112131415161718192021222324
  1. {$mode objfpc}
  2. { we test the context sensitivity of generics here, by checking whether names
  3. are looked up at specialization or at definition time }
  4. uses
  5. ugeneric14;
  6. const
  7. Foo = 4;
  8. type
  9. TIntTest = specialize TGTest<Integer>;
  10. var
  11. A: TIntTest;
  12. begin
  13. A := TIntTest.Create;
  14. A.DoSomething;
  15. writeln(A.data);
  16. if A.data = 4 then
  17. halt(1);
  18. A.Free;
  19. end.