multiple inheritance example

Example 1: how u can achieve multiple inheritances

Multiple inheritance in Java programming is achieved or 
implemented using interfaces. Java does not support multiple 
inheritance using classes.
In simple term, a class can inherit only one class and multiple 
interfaces in a java programs. In java terminology, we can say that

“A class can extend only one class but it can implement 
multiple interfaces.

Example 2: multiple inheritance in java

Multiple inheritance is achieved and
implemented using interfaces

Example 3: multiple inheritance in c++

#include<iostream> 
using namespace std; 

class A 
{ 
public: 
A() { cout << "A's constructor called" << endl; } 
}; 

class B 
{ 
public: 
B() { cout << "B's constructor called" << endl; } 
}; 

class C: public B, public A // Note the order 
{ 
public: 
C() { cout << "C's constructor called" << endl; } 
}; 

int main() 
{ 
	C c; 
	return 0; 
}