In virtual inheritance, the base class is initialized by the top member of the hierarchy. That is, if the base constructor is not explicitly specified in the initialization list of the child class, then the default constructor will be called, and any other call to the constructor of the base virtually inherited class in the middle of the hierarchy will be ignored. In this case, the Prius class constructor first of all implicitly calls the default constructor of the Car class. The explicit call of the Car constructor in the Toyota class is ignored.
Войдите чтобы поставить Нравится
Войдите чтобы прокомментировать