OOAD Princhiples Q/A #2



Question:What is the difference between Multilevel and Muliple Inheritance?

Answer:

Sr. No. Multilevel Inheritance Multiple Inheritance
1 In multilevel inheritance, features of only one base class are allowed in derived class. In multile inheritance, features of several classes can be clubbed in a derived class.
2 It consists of many levels of inheritance. It consists of only two levels of inheritance.
3 A class can be derived from already derived class as shown below. Multilevel Inheritance A class can be derived from multiple classes as shown below. Multiple Inheritance
4 Syntax is
class x {}
class y: visibility_control x {}
class z: visibility_control y {}
Syntax is
class x {}
class y {}
class z: visibility_control x, visibility_control y {}
Advertisements