在Unit2单元中怎么定义shape类呀

解决方案 »

  1.   

    TMyShape = class(TShape)
      

  2.   

    嘻嘻,上边说了;
    Type//在这儿写,嘻嘻
    你的新类 = Class(TShape);
    //俺没有接过你的分,嘻嘻
      

  3.   

    关键是这个新类中的方法怎么定义呀,我以前是学JAVA的,现在非得让我用DELPHI做,我也很喜欢DELPHI,可以是新手,还得请大家多指教呀,然后在unit1单元怎么使用这些方法呀!!!
      

  4.   

    嘻嘻,方法,你随便看一看那些源码就知道啦,而且,要放在Public里边;
    在Unit1里
    Uses
      Unit2;
    嘻嘻
      

  5.   

    unit unit2;
    interface
      TDescendant = class(TAncestor)
      public
        //class methods declaration goes here
      end;unit unit1;
    implementation
      uses unit2;
    var
      Descendant := TDescendant;
      

  6.   

    unit unit2;interface
    uses
     Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
      ExtCtrls;
    type
      TDescendant = class(TAncestor)
     // public
        //class methods declaration goes here
      end;
    implementation{$R *.DFM}end.
    //编译上述代码是出现错误如下是什么意思
    //[Error] Unit2.pas(8): Undeclared identifier: 'TAncestor'
    //[Fatal Error] Project1.dpr(6): Could not compile used unit 'Unit2.pas'
      

  7.   

    TAncestor没有定义,如果你定义了,那就是还没注册
      

  8.   

    TAncestor是从那继承来的啊?你当前是在Unit中定义一个类啊!
      

  9.   

    uses unit2
    你说很多人认识你,我怎么不认识你啊?自我介绍一下吧。