Where is the “virtual” keyword necessary in a complex multiple inheritance hierarchy?
问题 I understand the basics of C++ virtual inheritance. However, I'm confused about where exactly I need to use the virtual keyword with a complex class hierarchy. For example, suppose I have the following classes: A / \ B C / \ / \ D E F \ / \ / G H \ / I If I want to ensure that none of the classes appear more than once in any of the subclasses, which base classes need to be marked virtual ? All of them? Or is it sufficient to use it only on those classes that derive directly from a class that