Multiple Inheritance in C++ Programming
Inheritance is the process of inheriting properties of objects of one class by objects of another class. The class which inherits the properties of another class is called Derived or Child or Sub class and the class whose properties are inherited is called Base or Parent or Super class. When a class is derived from two or more base classes, such inheritance is called Multiple Inheritance. It allow us to combine the features of several existing classes into a single class.
For example,
- Petrol is derived from both liquid and fuel.
- A child has character of both his/her father and mother, etc
Syntax of Multiple Inheritance
class base_class1 { properties; methods; }; class base_class2 { properties; methods; }; ... ... ... ... ... ... class base_classN { properties; methods; }; class derived_classname : visibility_mode base_class1, visibility_mode base_class2,... ,visibility_mode base_classN { properties; methods; };