我查了很多书都没有怎么介绍 inherited 的
请问高手能否详细的给小弟介绍一下 inherited 的使用方法???

解决方案 »

  1.   

    // 执行父类相应的方法,继承的体现 ; 如 :constructor TTest.Create ;
    begin
      inherited Create(false) ; // 先执行父类的Create方法,继承父类
      i := 1 ;                  // 再具体化子类
    end ;
      

  2.   

    如果constructor create的话
    应先
      inherited create(false);           //先让父类初始一些基类的变量(控件)
      adoquery1:=Taodquery.create(self); //派生类再处理自己的变量(控件)如果destructor destory
       
        adoquery1.free;
        adoquery:=nil;    inherited destroy;               //先构释派生类的控件(变量),再调用父类的destroy
      
       
    不知这样理解对不对?
      

  3.   

    比如父类中的过程formsave中已经写的代码如果在子类的过程fromsave中想继续使用的话,就加入inherited;这样就可以使用这些代码而不用从写了.如果不想用而只想使用自己写的代码就不写inherited;