Both paragraphs, 7.3.3.p1 and p3, in the C++11 Standard, make reference to a using-declaration naming a constructor. Why is this necessary? The code below shows that the base class A
's constructors are seen in the derived class B
as expected.
class A
{
int i;
public:
A() : i(0) {}
A(int i) : i(i) {}
};
class B : public A
{
public:
// using A::A;
A f1() { return A(); }
A f2() { return A(1); }
};
int main()
{
B b;
A a1 = b.f1();
A a2 = b.f2();
}
If I comment out using A::A;
above nothing changes in the program execution.