// Easy multiple inheritance example #include using namespace std; class One { protected: int a, b; public: One(int arg1, int arg2) : a(arg1), b(arg2) { } virtual void show() const { cout << a << ' ' << b << endl; } }; class Two { protected: int c,d; public: Two(int arg1, int arg2) : c(arg1), d(arg2) { } virtual void show() const { cout << c << ' ' << d << endl; } }; class Three : public One, public Two { private: int e; public: Three(int, int, int, int, int); void show() const override { cout << a << ' ' << b << ' ' << c << ' ' << d << ' ' << e << endl; } }; Three::Three(int arg1, int arg2, int arg3, int arg4, int arg5) : One(arg1,arg2), Two(arg3,arg4), e(arg5) { } int main() { One object1(5,7); object1.show(); // prints 5 7 Two object2(8,9); object2.show(); // prints 8 9 Three object3(2,4,6,8,10); object3.show(); // prints 2 4 6 8 10 }