tampurus

11.3 Multiple Inheritance

Jan 7th, 2022 (edited)
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.52 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. class A {protected: int a;};
  5. class B {protected: int b;};
  6. class C {protected: int c;};
  7. class D {protected: int d;};
  8.  
  9. class E : public A,B,C,D {
  10. protected:
  11.     int e;
  12. public:
  13.     void get()
  14.     {
  15.         cout<<"Enter five numbers"<<endl;
  16.         cin>>a>>b>>c>>d>>e;
  17.     }
  18.     void show()
  19.     {
  20.         cout<<"six numbers are"<<endl;
  21.         cout<<a<<" "<<b<<" "<<c<<" "<<d<<" "<<e;
  22.     }
  23. };
  24.  
  25. int main()
  26. {
  27.     E obj;
  28.     obj.get();
  29.     obj.show();
  30.     return 0;
  31. }
Add Comment
Please, Sign In to add comment