![prakash.athani](https://www.crazyengineers.com/img/avatar.jpg)
Member • Jul 2, 2008
Member • Jul 2, 2008
Administrator • Jul 2, 2008
Member • Jul 3, 2008
Member • Jul 4, 2008
shalini_goel14Check the following scenario:
class A{
void method1(){
//some code here
}
}
class B{
void method1(){
// some code here
}
class C extends A,B { //do not try..not possible in java
//assuming it inherits method1() method
}
class JavaMultipleInheritenceTest{
public static void main(String args[]){
C cObj=new C();
cObj.method1();//creates an ambiguous situation for JVM to detect which
class's overridden method method1() it is asking for(classA or class B)
}
}
This is the reason in Java we cannot extend multiple classes but can extend multiple interfaces.
Member • Jul 6, 2008
Member • Jul 7, 2008
Member • Jul 7, 2008
Member • Jul 7, 2008
Member • Jul 7, 2008
In some parts of the object-oriented community, the mere mention of multiple inheritance seems to evoke visions of mysterious, uncharted territories where complexity is the law of the land and treacherous ambiguities lie in cover behind every bush, ready to prey on the poor wandering programmer. The purpose of this month's column is to dispel any such image and show that multiple inheritance is in fact as simple to use as it is powerful.<a href="https://archive.eiffel.com/doc/manuals/technology/bmarticles/joop/multiple.html" target="_blank" rel="nofollow noopener noreferrer">Harnessing multiple inheritance</a>