A是基类、B继承A、C继承B、若C函数中有inherited方法,则C中所调用的以及实现的就是全为B中的,同样,B中若有inherited,则B中调用的全为A中的。
代码如下:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
function show:Integer;virtual;
function NumCount:Integer;virtual;
end;
TForm2 = class(TForm1)
public
function NumCount:Integer;override;
end;
TestA = class
public
function TestXX:string;virtual;
end;
TestB = Class(TestA)
public
function TestXX:String;override;
End;
TestC = class
public
function Test:string;
end;
var
Form1: TForm1;
implementation