Reputation: 941
As far as I understood, the using
keyword can be used for inheriting constructors of a base class. In this code I'm trying to reuse the constructors of Base
while making them public. Compilers say error : calling a protected constructor of class 'Base'
. What is it that I'm misunderstanding here?
struct Base
{
protected:
Base() = default;
Base(int, int) {}
};
struct Derived1 : public Base
{
public:
using Base::Base;
};
//...
Derived1 d2(4,2); // ERROR
Upvotes: 1
Views: 176