'Why we uses nonpublic inheritance when we need to share a common virtual base class or override the construction of a virtual base class?

Herb Sutter's book exceptional C++ item24 explains several cases when we uses nonpublic inheritance. Nonpublic inheritance means public or protected inheritance of class.

I understand other cases but I'm not clear the case 4 below.

why use nonpublic inheritance? Here are several reasons, in rough order from most to least common.

case 1 blah...

case 2 blah...

case 3 blah...

case 4 We need to share a common virtual base class or override the construction of a virtual base class. The first part applies if the using class has to inherit from one of the same virtual bases as the used class. If it does not, the second part may still apply. The most-derived class is responsible for initializing all virtual base classes, so if we need to use a different constructor or different constructor parameters for a virtual base, then we must inherit.

What does this sentence mean? Could someone give me some example code for this ?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source