fpc/bugs/bug0187.pp
1999-01-04 13:36:05 +00:00

67 lines
1.1 KiB
ObjectPascal

program test;
type
Tbaseclass = object
constructor Init;
destructor Done;
procedure Run; virtual;
end;
Totherclass = object(Tbaseclass)
procedure Run; virtual;
end;
constructor Tbaseclass.Init;
begin
writeln('Init');
Run;
end;
destructor Tbaseclass.Done;
begin
writeln('Done');
end;
procedure Tbaseclass.Run;
begin
writeln('Base method');
end;
procedure Totherclass.Run;
begin
writeln('Inherited method');
end;
var base : Tbaseclass;
other : Totherclass;
// asmrec : Tasmrec;
testfield : longint;
begin
// Uncommenting here and commenting the init in the WIth solves it.
// Base.Init;
with base do
begin
Init;
Run;
Done;
end;
// Uncommenting here and commenting the init in the WIth solves it.
// Other.init;
with other do
begin
Init;
Run;
Done;
end;
{ Calls Tbaseclass.Run when it should call Totherclass.Run }
end.