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 / tthlp12.pp
Size: Mime:
{ this checks that inheritance for type helper is working correctly }

program tthlp12;

{$mode objfpc}
{$modeswitch typehelpers}

type
  TLongIntHelper = type helper for LongInt
    function Test: Integer;
  end;

  TLongIntHelperSub = type helper(TLongIntHelper) for LongInt
    function Test: Integer;
  end;

function TLongIntHelper.Test: Integer;
begin
  Result := 21;
end;

function TLongIntHelperSub.Test: Integer;
begin
  Result := inherited Test * 2;
end;

var
  i: LongInt;
begin
  if i.Test <> 42 then
    Halt(1);
  Writeln('OK');
end.