Implementing multiple interfaces in c++

前端 未结 4 1949
后悔当初
后悔当初 2020-11-28 15:43

I have the interface hierarchy as follows:

class A
{
public:
 void foo() = 0;
};

class B: public A
{
public:
void testB() = 0;
};

class C: public A
{
publi         


        
4条回答
  •  天涯浪人
    2020-11-28 16:15

    Do

    class BImpl : public B {
        // code ...
    }
    

    but in B, declare the functions as virtual so the compiler will force you to implement them in BImpl

提交回复
热议问题