1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
{ %fail } {$mode objfpc}{$H+} type generic TGenMap<T> = class(TObject) function Add(const AKey: T): T; end; function TGenMap.Add(const AKey: T): T; begin end; var a: TGenMap; begin a := TGenMap.Create; a.Add(5); a.Free; end.