mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-10-19 12:51:35 +02:00

rtl: fix fgl to use the new syntax tests: fix generics tests to use the new syntax git-svn-id: trunk@15646 -
45 lines
580 B
ObjectPascal
45 lines
580 B
ObjectPascal
{$mode objfpc}{$h+}
|
|
type
|
|
generic TNode<T> = class
|
|
public
|
|
type
|
|
PT = T;
|
|
private
|
|
var
|
|
Data: T;
|
|
public
|
|
constructor Create;
|
|
destructor Destroy; override;
|
|
end;
|
|
|
|
TTNodeLongint = specialize TNode<Longint>;
|
|
|
|
TTNodeString = specialize TNode<String>;
|
|
|
|
constructor TNode.Create;
|
|
begin
|
|
end;
|
|
|
|
destructor TNode.Destroy;
|
|
begin
|
|
inherited Destroy;
|
|
end;
|
|
|
|
|
|
function GetIntNode: TTNodeLongint.T;
|
|
begin
|
|
result := 10;
|
|
end;
|
|
|
|
|
|
function GetStringNode: TTNodeString.PT;
|
|
begin
|
|
result := 'abc';
|
|
end;
|
|
|
|
begin
|
|
writeln(GetIntNode);
|
|
writeln(GetStringNode);
|
|
end.
|
|
|