lundi 3 août 2020

C++11/14/17...: Constructors can only be inherited DIRECTLY from the base?

I have a base class A, that defines some constructors.

Then I have classes B1, B2, B3 that inherit from A.

None of these are meant to be instantiated. Instead, I have classes C11, C12, C13 inheriting from B1, and so on.

C11, C12 etc. all need A's constructors.

I don't think I can write using A::A; in class C11, for instance, right?

The only way to get these constructors (other than cutting and pasting them) is for B1 to say using A::A; and C11 to say using B1::B1;?

Note my question isn't about what a particular compiler supports, but what the spec allows, so "just test it" isn't really an answer to this particular question.

Aucun commentaire:

Enregistrer un commentaire