Consider:
struct foo
{
foo() {}
foo(int) {}
};
struct bar : foo
{
using foo::foo;
};
int main()
{
bar b;
}
This compiles: Since bar
has no user-declared constructors, a default constructor will be declared implicitly.
struct foo
{
foo() {}
foo(int) {}
};
struct bar : foo
{
using foo::foo;
bar(double) {}
};
int main()
{
bar b;
}
This does not compile. The default constructor is not inherited, and it is not declared implicitly, since there is the bar(double)
constructor.