solving diamond problem using hybrid inheritance code example
Example 1: solution of diamond problem in c++
Virtual inheritance solves the classic “Diamond Problem”.
It ensures that the child class gets only a single instance of the common base class.
Example 2: c++ multiple inheritance diamond problem
class Parent;
class a : virtual public Parent; //add virtual
class b : virtual public Parent; //add virtual
class c : public a, public b;