如何实现两个具有相同功能的接口

时间:2012-10-18 13:50:32

标签: c++ interface abstract-class implementation

  

可能重复:
  C++ virtual override functions with same name

我的类必须使用相同的方法实现两个接口。例如:

class IInterface1
{
public:
    virtual void Method() = 0;
};

class IInterface2
{
public:
    virtual void Method() = 0;
};

class Implementation : public IInterface1, IInterface2
{
    // ???
};

这可能吗?如果是,那么在.h和.cpp文件中使用的确切语法是什么。

请注意。我可以使用两个实现IInterface1和IInterface2的辅助类来完成此操作。但我很好奇是否可以直接做。

0 个答案:

没有答案
相关问题