C++ multiple inheritance function call ambiguity

前端 未结 2 1301
眼角桃花
眼角桃花 2020-11-29 02:50

I have a basic question related to multiple inheritance in C++. If I have a code as shown below:

struct base1 {
   void start() { cout << \"Inside base         


        
2条回答
  •  时光说笑
    2020-11-29 03:34

    a.base1::start();
    
    a.base2::start();
    

    or if you want to use one specifically

    class derived:public base1,public base2
    {
    public:
        using base1::start;
    };
    

提交回复
热议问题