jeudi 7 janvier 2021

The class inherits the base class in a private way, and its derived class cannot define the object of the indirect base class

When the direct base class inherits the indirect base class in a private way, the derived class of the direct base class cannot define the object of the indirect base class in the class. Why?

class Try
{
public:
    Try() = default;
};

class B1 : private Try
{};

class C1 : public B1
{
    Try a;
};

the Try a will be error

Aucun commentaire:

Enregistrer un commentaire