mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-07 17:47:56 +02:00

rtl: fix fgl to use the new syntax tests: fix generics tests to use the new syntax git-svn-id: trunk@15646 -
33 lines
472 B
ObjectPascal
33 lines
472 B
ObjectPascal
unit ugeneric10;
|
|
|
|
{$mode objfpc}
|
|
|
|
interface
|
|
|
|
type
|
|
generic TList<_T>=class(TObject)
|
|
public
|
|
type
|
|
TCompareFunc = function(const Item1, Item2: _T): Integer;
|
|
public
|
|
var
|
|
data : _T;
|
|
procedure Add(item: _T);
|
|
procedure Sort(compare: TCompareFunc);
|
|
end;
|
|
|
|
implementation
|
|
|
|
procedure TList.Add(item: _T);
|
|
begin
|
|
data:=item;
|
|
end;
|
|
|
|
procedure TList.Sort(compare: TCompareFunc);
|
|
begin
|
|
if compare(data, 20) <= 0 then
|
|
halt(1);
|
|
end;
|
|
|
|
end.
|