kethlin Said..
Virtual base classes in C++
A class can be an indirect base class to a derived class more than once so C++ provides a way to optimize the way such base classes work. Virtual base classes offer a way to save space and avoid ambiguities in class hierarchies that use multiple inheritances. Each nonvirtual object contains a copy of the data members defined in the base class. This duplication wastes space and requires you to specify which copy of the base class members you want whenever you access them.
When a base class is specified as a virtual base, it can act as an indirect base more than once without duplication of its data members. A single copy of its data members is shared by all the base classes that use it as a virtual base.
Example: suppose you have two derived classes B and C that have a common base class A, and you also have another class D that inherits from B and C. You can declare the base class A as virtual to ensure that B and C share the same sub-object of A.
In the following example, an object of class D has two distinct sub-objects of class L, one through class B1 and another through class B2. You can use the keyword virtual in front of the base class specifies in the base lists of classes B1 and B2 to indicate that only one sub-object of type L, shared by class B1 and class B2, exists.
For example:
class L { /* ... */ }; // indirect base class
class B1 : virtual public L { /* ... */ };
class B2 : virtual public L { /* ... */ };
class D : public B1, public B2 { /* ... */ }; // valid
Using the keyword virtual in this example ensures that an object of class D inherits only one sub-object of class L.
A derived class can have both virtual and nonvirtual base classes. For example:

class V { /* ... */ };
class B1 : virtual public V { /* ... */ };
class B2 : virtual public V { /* ... */ };
class B3 : public V { /* ... */ };
class X : public B1, public B2, public B3 { /* ... */
};
In the above example, class X has two sub-objects of class V, one that is shared by classes B1 and B2 and one through class B3.