我用Delphi封装一个COM的DLL,想添加一个Com组件,该类的接口类继承其他类的所有方法和属性,
采用 TMail = class(...,...,TFatherClass) 的方式来申明继承父类时出现错误:
interface type request.
请问象这样的问题如何解决,谢谢!

解决方案 »

  1.   

    你前面的......都必须是Interface不能有Class
      

  2.   

    type
       IFoo=interface
        ['{63B83BC3-96DB-4AF2-94C0-CE723630DDFA}'] //按CTRL+SHIFT+G自动生成
        function F1:Integer; 
       end;
       IBar=integer(IFoo) //继承
         ['{308BD10F-2CAF-4EC1-87DF-0D48E3EA9547}']
         function F2:Integer; 
       end;
    2.实现接口
       //接上
       TMyClass=class(TInterfaceedObject,IFoo,IBar)
         function F1:Integer;
         function F2:Integer;
       end;
      

  3.   

    但是我要引用父类只是一个普通的unit单元,
    它内部没有定义接口,我就是想通过COM组什封装这个unit单元,并继承它的类
    来实现在COM组件中公布这个类的所有public方法及属性,
    要怎么做呢,请赐教!谢谢
      

  4.   

    可以作伪继承
    TFoo = class(TInterfacedObject, IFOO)
    private
      FParentClass :TParentClass;
    public
      constructor Create;
      destructor Destroy;
      procedure ParentFunction1
      procedure ParentFunction2
    end;procedure TFoo.Create
    begin
      inherited;
      FParentClass := TParentClass.Create;
    endprocedure TFoo.Destroy;
    begin
      FParentClass.Free;
      inherited;
    end;procedure TFoo.ParentFunction1
    begin
      FParentClass.ParentFunction1;
    end;
    ...