One of the requirements of constructor inheritance is that the derived class can not have any constructors with the same signature. I am unsure however about how deleted functions behave under these rules.
class Foo
{
Foo() = delete;
Foo(const Foo& a_Foo) = delete;
};
class Bar : public Foo
{
using Foo::Foo;
Bar();
Bar(const Bar& a_Bar);
};
- Are deleted constructors inherited at all?
- If so,
Bar()
andFoo()
have the same signature, does this make the code invalid? - You could argue that
Foo(const Foo& a_Foo)
andBar(const Bar& a_Bar)
have different signatures. How do copy constructors behave under constructor inheritance?
Aucun commentaire:
Enregistrer un commentaire