+ 1
Is the possible deadly diamond of death in Java ?
Using, Class, Interface or enum.. for interface can multiple extends. so is there deadly diamond problem possible or not? example : A,B, C and D are the four interfaces then parent-child relationship is A / \ B C \ / D
4 Respuestas
+ 5
Hello, Sandeep Kushwaha !
What do you mean?
Please write in more detail, and people will be able to help you.
+ 5
Please read the link I provided. It already answered to your question before you edited it.
" ...interfaces specify only what the class is doing, not how it is doing it... "
subclasses merely implement interfaces, not extend their behaviour. The diamond problem exists when a subclass inherits from multiple superclasses which have conflicting definitions for what an inherited method should do. By implementing interfaces, you define how the class performs the method.
+ 4
Multiple inheritance is not allowed in Java, so there's no diamond problem there. You may point out that implementing multiple interfaces are allowed -
https://stackoverflow.com/questions/2515477/why-is-there-no-multiple-inheritance-in-java-but-implementing-multiple-interfac
0
is D faced "Deadly diamond of death".? in question