When I use using
like this why is the constructor inherited publicly?
class Base {
int x;
public:
Base(int x);
};
class Derived : public Base {
using Base::Base;
};
I can now do:
Derived d (2);
I thought that using
declarations had the visibility of where they are situated. Here, it should be private.
From The C++ Programming Language:
A name brought into a derived class scope by a using-declaration has its access determined by the placement of the using-declaration;