blob: eff201d70826c68b36421233defd6b55d2286296 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
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.
|