C++ 实现从派生自另一个接口的接口派生的类
我有以下接口和类C++ 实现从派生自另一个接口的接口派生的类,c++,com,C++,Com,我有以下接口和类 public interface IBase { virtual void SomeBaseMethod()=0; } public interface IDerived : IBase { virtual void SomeOtherMethod()=0; } public class base: public IBase { void SomeBaseMethod(){}; } public class derived: public base
public interface IBase
{
virtual void SomeBaseMethod()=0;
}
public interface IDerived : IBase
{
virtual void SomeOtherMethod()=0;
}
public class base: public IBase
{
void SomeBaseMethod(){};
}
public class derived: public base, public IDerived
{
void SomeBaseMethod(){};
void SomeOtherMethod(){};
}
在派生类中,我必须重复“void SomeBaseMethod(){};”,已经在我的类库中实现了。否则我将得到编译错误。是否可以不重复“void SomeBaseMethod(){};”在我的课堂上?不幸的是,你必须在这里重复一遍。C++具有虚拟继承,它可以解决这个问题,但是不能使用COM接口使用虚拟继承。你有问题。C++的哪个版本有关键字<代码>接口< /代码>。看起来更像java。@ ToMatasMatthWS不是标准C++,但它是(我不鼓励使用)。