codetools: example for new fpc features

git-svn-id: trunk@29300 -
This commit is contained in:
mattias 2011-02-01 22:33:39 +00:00
parent 7f574e6384
commit 0e193c1379

View File

@ -76,9 +76,23 @@ type
generic TRecG<T> = record
F: T;
end;
// delphi generic please see in:
// tgeneric28.pp, tgeneric29.pp, tgeneric32.pp, tgeneric34.pp
TGenericArray<T> = array of T;
IGenericInterface<T> = interface
function DoSomething(Arg: T): T;
end;
TGenericClass<T1,T2> = class(TInterfacedObject, IGenericInterface<T1>)
F: T2;
type
Intf = IGenericInterface<Integer>;
function DoSomething(Arg: T1): T2;
function Test(Arg: Intf): Intf;
end;
var
ArraySpecialize: TGenericArray<Integer>;
ClassSpecialize: TGenericClass<Integer,String>;
begin
FooInt := TGenericClass<Integer,String>.Create;
end.