Why multiple inheritance is removed from Java?

Questions by vmshenoy   answers by vmshenoy

  
Showing Answers 1 - 9 of 9 Answers

jude

  • Jan 18th, 2007
 

 if not removed totally .........but why?

We need to take a small example with some classes.

A
/
/
B C
/
/
D

Let's consider this simple example where B and C inherit from A and D inherits from B&c (typical combination of C++'s hierarchical and multiple inheritance). For this discussion let's not consider the hierarchical inheritance. Consider the multiple inheritanace, if the child class D has to get a handle of grandparent, A, then, it can achieve it through two ways viz.,

one of its parent B and through
another parent C

Now, D has a duplicate reference to access its grandparent A, just in order to avoid this chaos.....

Hope you got it

  Was this answer useful?  Yes

Sherlin

  • Mar 24th, 2007
 


Multiple Inheritance is not removed, it is implemented by means of Interfaces in Java

  Was this answer useful?  Yes

sridevi.gg

  • Apr 7th, 2010
 

Multiple inheritence is not removed from Java, it is complex while accesing the methods.  Inheriting the sub class from two or more super class is called multiple inheritence.  If both the super class have some methods and object is created for sub class so, with the help of that object we can access the methods in the super class here the confusion is which super class methods are going to be accessed. Because of this, Java dose not support multiple inheritecnce but it is possible through interfaces.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions