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.0.0 / tests / test / tstatic2.pp
Size: Mime:
program tstatic2;
{$APPTYPE console}
{$ifdef fpc}
  {$mode delphi}{$H+}
{$endif}

type
  TSomeClass = class
  private
    class var
      FSomethingStatic: Integer;
  public
    class procedure SetSomethingStatic(AValue: Integer); static;
    class property SomethingStatic: Integer read FSomethingStatic write SetSomethingStatic;
  end;

  TAnotherClass = class(TSomeClass)
  end;

{ TSomeClass }

class procedure TSomeClass.SetSomethingStatic(AValue: Integer);
begin
  FSomethingStatic := AValue;
  WriteLn('SomethingStatic:', SomethingStatic);
end;

begin
  TSomeClass.SomethingStatic := 4;
  if TSomeClass.SomethingStatic <> 4 then
    halt(1);
  TAnotherClass.SomethingStatic := 10;
  if TSomeClass.SomethingStatic <> 10 then
    halt(2); // outputs 10
end.