Multiple inheritance relationships can be achieved using internal classes:
As follows:
Class D {}
Abstract class E {}
Class Z extends d {
E makee () {return New E (){};}
}
Public class multiimplementation {
Static void takesd (d ){}
Static void takese (E ){}
Public static void main (string [] ARGs ){
Z = new Z ();
Takesd (z );
Takese (Z. makee ());
}
}
As shown above: Multi-inheritance can be implemented.
Benefits of internal classes:
1. The internal class can have multiple instances, each of which has its own status information and its peripheral class
The information of the image is independent of each other.
2. In a single peripheral class, you can allow multiple internal classes to implement the same interface in different ways, or
The same class. This example will be displayed later.
3. Creating internal class objects does not depend on creating peripheral class objects.
4. The internal class has no confusing "is-a" relationship; it is an independent entity.