C++11 inheriting constructors and access modifiers

前端 未结 1 2023
眼角桃花
眼角桃花 2020-11-27 19:12

Assuming the following layout:

class Base
{
protected:
    Base(P1 p1, P2 p2, P3 p3);

public:
    virtual void SomeMethod() = 0;
}

class Derived : public B         


        
相关标签:
1条回答
  • 2020-11-27 19:59

    According to 12.9/4, "Inheriting constructors", when saying using X::X,

    A constructor so declared has the same access as the corresponding constructor in X.

    So the inherited constructor is also protected.

    0 讨论(0)
提交回复
热议问题