mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-06 22:07:56 +02:00
56 lines
624 B
ObjectPascal
56 lines
624 B
ObjectPascal
|
|
type
|
|
TObj = object
|
|
constructor Init0;
|
|
constructor Init;
|
|
procedure Show;
|
|
function GetStr:string; virtual;
|
|
destructor Done;
|
|
end;
|
|
|
|
TChild = object (TObj)
|
|
function GetStr:string; virtual;
|
|
end;
|
|
|
|
var
|
|
Err : boolean;
|
|
|
|
constructor TObj.Init0;
|
|
begin
|
|
end;
|
|
|
|
constructor TObj.Init;
|
|
begin
|
|
Init0;
|
|
end;
|
|
|
|
function TObj.GetStr:string;
|
|
begin
|
|
GetStr:='Bad';
|
|
Err:=true;
|
|
end;
|
|
|
|
procedure TObj.Show;
|
|
begin
|
|
writeln(GetStr);
|
|
end;
|
|
|
|
destructor TObj.Done;
|
|
begin
|
|
end;
|
|
|
|
function TChild.GetStr:string;
|
|
begin
|
|
GetStr:='Good'
|
|
end;
|
|
|
|
var
|
|
Obj:TChild;
|
|
begin
|
|
Obj.Init;
|
|
Obj.Show;
|
|
Obj.Done;
|
|
if Err then
|
|
halt(1);
|
|
end.
|