1.

What is virtual base class? Give example.

Answer»

The base class is declared as the virtual base class so that only one copy of its members are inherited by the derived class in a hybrid inheritance. For example, the derived class D derive from the classes B and C whereas both the classes B and C are derived from base class A. Then base class A is inherited twice and to avoid two copies of class A to class D, class A is declared virtual base class.



Discussion

No Comment Found