fpc/tests/test/tchlp59.pp
2017-08-25 19:36:56 +00:00

41 lines
549 B
ObjectPascal

program tchlp42;
{$mode objfpc}
type
TTest = class
function Test: LongInt; virtual;
end;
TTestSub = class(TTest)
function Test: LongInt; override;
end;
TTestHelper = class helper for TTest
function Test: LongInt;
end;
function TTestHelper.Test: LongInt;
begin
Result := inherited Test * 10;
end;
function TTestSub.Test: LongInt;
begin
Result := 2;
end;
function TTest.Test: LongInt;
begin
Result := 1;
end;
var
t: TTest;
begin
t := TTestSub.Create;
if t.Test <> 20 then
Halt(1);
Writeln('ok');
end.