In a virtual derivation, the virtual base is initialized by the most derived constructor. In our example, when we create a
Panda object, the
Panda constructor alone controls how the
ZooAnimal base class is initialized.
To understand this rule, consider what would happen if normal initialization rules applied. In that case, a virtual base class might be initialized more than once. It would be initialized along each inheritance path that contains that virtual base. In our
ZooAnimal example, if normal initialization rules applied, both
Raccoon would initialize the
ZooAnimal part of a
Of course, each class in the hierarchy might at some point be the “most derived” object. As long ...