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 / webtbs / tw30015.pp
Size: Mime:
program project1;

{$mode objfpc}

{$Inline On} // inline must be turned on for both methods
type
  TTest = object // both methods must be inside of object
    procedure ModifyValue(ValueModify: Int32); inline;
    procedure SetKey(const ValueConst: Int32); inline;
  end;

  procedure TTest.ModifyValue(ValueModify: Int32);
  begin
    ValueModify := 1;
  end;

  procedure TTest.SetKey(const ValueConst: Int32);
  var
    OriginalValue: Int32;
  begin
    OriginalValue := ValueConst;
    ModifyValue(ValueConst);
    WriteLn('Current Value: ', ValueConst); //Outputs 1
    WriteLn('Original Value: ', OriginalValue); //Outputs 2
    if (OriginalValue<>2) or
       (ValueConst<>2) then
      halt(1);
  end;

var
  TestObj: TTest;
  i: Int32;

begin
  i := 1;
  TestObj.SetKey(i + 1);
end.