Difference between Single Inheritance and Multiple Inheritance
S.NO | Single Inheritance | Multiple Inheritance |
---|---|---|
1. | Single inheritance is one in which the derived class inherits the single base class. | Whereas multiple inheritance is one in which the derived class acquires two or more base classes. |
2. | In single inheritance, the derived class uses the features of the single base class. | While in multiple inheritance, the derived class uses the joint features of the inherited base classes. |
3. | Single inheritance requires a small run time as compared to multiple inheritance due to less overhead. | While multiple inheritance requires more run time as compared to single inheritance due to more overhead. |
4. | Single inheritance is a lot close to specialization. | In contrast, multiple inheritance is a lot close to generalization. |
5. |
Single inheritance is implemented as Class DerivedClass_name : access_specifier Base_Class{}; . |
Multiple inheritance is implemented as Class DerivedClass_name : access_specifier Base_Class1, access_specifier Base_Class2, ….{}; . |
6. | Single inheritance is simple in comparison to multiple inheritance. | While multiple inheritance is complex in comparison to single inheritance. |
7. | Single inheritance can be implemented in any programming language. | C++ supports multiple inheritance but multiple inheritance can’t be implemented in any programming language(C#, Java doesn’t support multiple inheritance). |
8. | Single inheritance constructs an inheritance tree. | Multiple inheritance constructs Inheritance Directed Acyclic Graph (DAG). |
Related Articles: