c++ virtual inheritance

virtual base classes are special in that they are initialized by the most derived class and not by any intermediate base classes that inherits from the virtual base. Which of the potential multiple initializers would the correct choice for initializing the one base?

If the most derived class being constructed does not list it in its member initalization list then the virtual base class is initialized with its default constructor which must exist and be accessible.

Note that a virtual base identifier is allowed to be use in a constructor’s initializer list even if it is not a direct base of the class in question.

Leave a Comment