Menu

(Solved) : Inheritance Question 7 Multiple Inheritance Case One Class Derived Two Classes Example Fol Q32520882 . . .

Inheritance Question 7 (a) Multiple inheritance is a case where one class is derived from two or more classes. For example, the following declaration shows that square is derived from both shape and polygon class square : public shape, polygon What are the advantages of multiple inheritance? What are the negative points and potential problems of multiple inheritance? [3 marks] (b) Given the C++ declaration: class A public: protected: int y; int x Which of the following would be rejected by the compiler? Explain you an- swer briefly. 1) class B: public A void f) {x - y; > Vol 2) class B J; 3) class B: public A t ; class C: public void f) { x - y; ) 4) Both variants 2 and 3 5) None of the above [3 marks]

Inheritance Question 7 (a) Multiple inheritance is a case where one class is derived from two or more classes. For example, the following declaration shows that square is derived from both shape and polygon class square : public shape, polygon What are the advantages of multiple inheritance? What are the negative points and potential problems of multiple inheritance? [3 marks] (b) Given the C++ declaration: class A public: protected: int y; int x Which of the following would be rejected by the compiler? Explain you an- swer briefly. 1) class B: public A void f) {x – y; > Vol 2) class B J; 3) class B: public A t ; class C: public void f) { x – y; ) 4) Both variants 2 and 3 5) None of the above [3 marks] Show transcribed image text

Expert Answer


Answer to Inheritance Question 7 Multiple Inheritance Case One Class Derived Two Classes Example Fol Q32520882 . . .

OR