mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-06-03 04:58:22 +02:00
codetools: example for new fpc features
git-svn-id: trunk@29300 -
This commit is contained in:
parent
7f574e6384
commit
0e193c1379
@ -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.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user