delphi面向对象 继承窗体

delphi继承form

  TFrmBase = class(TForm)
procedure FormShow(Sender: TObject);
end;
procedure TFrmBase.FormShow(Sender: TObject);
begin
ShowMessage('base show');
end;
type
TFrmBase14 = class(TFrmBase)procedure FormShow(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
procedure TFrmBase14.FormShow(Sender: TObject);
begin
inherited;
ShowMessage('child show');
end;

没有inherited;就不会调用父类的方法。

http://blog.csdn.net/foreverhuylee/article/details/37907817

    class t0
{
public:
int a; void fun() {a++;
}
}; class t1 :public t0
{
public: //int a; void fun() {t0::fun(); a = a * ;
}
}; t1 t;
t.a = ;
t.fun();
t.a = ;

调用父类方法必须明确写上。t0::fun();

上一篇:poj 1664 放苹果 (划分数)


下一篇:【转载】C/C++杂记:NULL与0的区别、nullptr的来历