mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-07 17:47:56 +02:00
20 lines
278 B
ObjectPascal
20 lines
278 B
ObjectPascal
program tgeneric24;
|
|
|
|
{$mode objfpc}{$H+}
|
|
{$apptype console}
|
|
|
|
type
|
|
generic TFoo<T> = record
|
|
F: T;
|
|
end;
|
|
var
|
|
FooInt: specialize TFoo<Integer>;
|
|
FooStr: specialize TFoo<String>;
|
|
begin
|
|
FooInt.F := 1;
|
|
WriteLn(FooInt.F);
|
|
FooStr.F := 'test';
|
|
WriteLn(FooStr.F);
|
|
end.
|
|
|