What is the advantages of virtual base class?

Virtual base classes are useful in multiple inheritance cases where two or more classes share a common base class. For instance, if class A is a common base class of classes B and C, and class D is derived from both B and C, then class D inherits two instances of class A (one from B, the other from C). This introduces an ambiguity to class D insofar as you cannot access A implicitly; you must explicitly access A via B or D. By declaring A to be virtual in both B and C, they will both share the same instance of A, thus class D inherits only one instance of A, thus eliminating the ambiguity, and reducing the memory footprint of class D.

Ideally, virtual base classes are abstract data types with little or no implementation and few if any member variables. Even so, not all base classes can be declared virtual in derived classes.