In "Multiple Inheritance" their are two Parent class and one Child class.
Basically in "Multiple Inheritance" their is more than one Parent class(BASE CLASS) which all are inherited to a single Child class(DERIVED CLASS).
Syntax:-
Also visit ----
Introduction to Inheritance
Single Inheritance
For giving some suggestion please comment us or check our "Contact us" page. Also more update related to coding will be added in this Blog later on, so please get attached with this Blog by clicking the follow button. Thank you for your support and time...
Basically in "Multiple Inheritance" their is more than one Parent class(BASE CLASS) which all are inherited to a single Child class(DERIVED CLASS).
Block-Diagram
Syntax:-
Example of Multiple Inheritance
#include<iostream> using namespace std; class Parent1 { protected: int a=10; }; class Parent2 { protected: int b=8; }; //Inheriting two different classes in one class using ',' class Child : public Parent1, public Parent2 { public: int c=12; void put() { cout<<"Sum is "<<a+b+c; } }; int main() { Child x; //'x' is the object of "Child class" x.put(); }
Also visit ----
Introduction to Inheritance
Single Inheritance
For giving some suggestion please comment us or check our "Contact us" page. Also more update related to coding will be added in this Blog later on, so please get attached with this Blog by clicking the follow button. Thank you for your support and time...
0 Comments