TVehicle = class (TObject)
  protected
    FColor: string;
    FMake: string;
    FTopSpeed: Integer;
    FWheel: TWheel;
    FWheels: TList;
    procedure SlowDown;
    procedure SpeedUp;
    procedure Start;
    procedure Stop;
  end;  TBicycle = class (TVehicle)
  public
    constructor create;
    destructor Destory;
    procedure ride;
  end;destructor TBicycle.Destory;
var
  i: Integer;
begin
  for i:=1  to 2 do
    TWheel(FWheels.Items[i]).Free;
  inherited;
end;inherited;的作用是什么啊?

解决方案 »

  1.   

    inherited;是继承TVehicle父类的destory方法
      

  2.   

    The reserved word inherited plays a special role in implementing polymorphic behavior. It can occur in method definitions, with or without an identifier after it.
      

  3.   

    inherited;是继承父类的现有的所有方法
    像你在destructor TBicycle.Destory;中使用inherited;就是继承了TBicycle的方法,而TBicycle类又继承了TVehicle的方法
      

  4.   

    TVehicle = class (TObject)
      protected
        FColor: string;
        FMake: string;
        FTopSpeed: Integer;
        FWheel: TWheel;
        FWheels: TList;
        procedure SlowDown;
        procedure SpeedUp;
        procedure Start;
        procedure Stop;
      end;TVehicle 中没有destructor Destory
      

  5.   

    procedure TForm1.createControlObj(ControlClass:TControlClass);
      var AControlObj:TControl;
    begin
      AControlObj:=ControlClass.Create(self);
      AControlObj.Parent:=self;
      AControlObj.Name:=AControlObj.ClassName;
      AControlObj.SetBounds(10,10,250,150);
      label1.Caption:=AControlObj.ClassName;
    end;中的self 表示的是什么啊?
      

  6.   

    self确切的说是二方面:引用对象和引用类.楼主这一问题似乎是刘艺<<面向对象思想>>时的吧,要多读前几篇啊,理论知识掌握了再实现.
      

  7.   

    To jinjazz( jinjazz(近身剪(N-P攻略))             为什么说destory是虚方法,难道只是因为它具有多态性吗