Explain why java doesn't support multiple inheritance Java does not support multiple inheritances. To avoid ambiguity problem – Diamonds of Death – and complexity of multiple inheritance.
The Diamond of Death is a problem without clarity. The Diamond problem is:
Two classes Two and Three inherit from class One. Class Four inherits from both Two and Three. When a method in Four invokes a method that is defined in One, and Two and Three have overridden that method in different way, the ambiguity and complexity occurs – through which class does it inherits: class Two or class Three?
Like wise if it is encouraged to have more than two classes to inherit, the ambiguity raises which leads to future conflict of applications.
|