Why would the conversion between derived* to base* fails with private inheritance?

后端 未结 7 499
栀梦
栀梦 2020-12-09 04:06

Here is my code -

#include
using namespace std;

class base
{
public:
    void sid()
    {
    }  
};

class derived : private base
{
public:         


        
7条回答
  •  离开以前
    2020-12-09 04:18

    I suspect the problem is that you can't convert a derived pointer to a base pointer, as the inheritance is private.

提交回复
热议问题