Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
fpc-src / usr / share / fpcsrc / 3.2.0 / tests / test / tgenfunc4.pp
Size: Mime:
{ test syntax of a generic class function in mode delphi }

program tgenfunc4;

{$mode delphi}

type
  TTest = class
    class function Add<T>(aLeft, aRight: T): T;
  end;

class function TTest.Add<T>(aLeft, aRight: T): T;
begin
  Result := aLeft + aRight;
end;

begin
  if TTest.Add<LongInt>(2, 3) <> 5 then
    Halt(1);
  if TTest.Add<String>('Hello', 'World') <> 'HelloWorld' then
    Halt(2);
end.