testinheritedexpr.out

来自「格式化源码的最新板」· OUT 代码 · 共 66 行

OUT
66
字号
unit TestInheritedExpr;

{ AFS 28 March 2000
 This unit compiles but is not semantically meaningfull
 it is test cases for the code formatting utility

 test call to inherited method 
}

interface

type
  TCityCounter = class(TObject)

  public
    function CountRats(const psCity: string): integer; virtual;
    function CountCheapTaxis: integer; virtual;
    procedure Foo; virtual;
  end;

  TLondonCounter = class(TCityCounter)
  public
    function CountRats(const psCity: string): integer; override;
    function CountCheapTaxis: integer; override;
    procedure Foo; override;
  end;


implementation

{ TRatCounter }

function TCityCounter.CountCheapTaxis: integer;
begin
  Result := -1;
end;

function TCityCounter.CountRats(const psCity: string): integer;
begin
  Result := 1000;
end;

procedure TCityCounter.Foo;
begin

end;

{ TLondonCounter }

function TLondonCounter.CountCheapTaxis: integer;
begin
  Result := inherited CountCheapTaxis;
end;

function TLondonCounter.CountRats(const psCity: string): integer;
begin
  Result := inherited CountRats('London') * 42;
end;

procedure TLondonCounter.Foo;
begin
  inherited;
end;

end.

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?