例如有这样的代码:
program Project1;
{$APPTYPE CONSOLE}
uses
Windows, SysUtils, Dialogs;
type
TA = class
public
procedure Test;
virtual;
procedure Call;
end;
TB = class(TA)
public
procedure Test;
override;
end;
TC = class(TB)
public
procedure Test;
override;
end;
{ TA }
procedure TA.Call;
begin
Test;
end;
procedure TA.Test;
begin
ShowMessage('A class');
end;
{ TB }
procedure TB.Test;
begin
inherited;
ShowMessage('B class');
end;
{ TC }
procedure TC.Test;
begin
//inherited;
ÎÒ²»Ïëµ÷Óø¸ÀàTBµÄTest·½·¨£¬
//TA.Test;
µ«ÎÒÒª¼Ì³ÐTAµÄTest·½·¨
ShowMessage('C class');
end;
var
c: TC;
begin
{ TODO -oUser -cConsole Main : Insert code here }
c := TC.Create;
c.Call;
c.Free;
end.