0

Why multiple inheritance does not work in java?

java

29th Oct 2017, 8:43 PM
Md Tarique Aziz
3 odpowiedzi
+ 11
Because in case two superclasses contain the same named method, which one should be used by the class that inherits from them both? It is the so-called "diamond problem": https://www.sololearn.com/discuss/800962/?ref=app https://www.sololearn.com/discuss/435220/?ref=app
29th Oct 2017, 8:47 PM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
+ 1
It's a feature, not a bug. Multiple inheritance can create serious problems(look up the diamond problem). So it was intenionally forbidden in Java.
29th Oct 2017, 8:46 PM
Hast du Brot
Hast du Brot - avatar
+ 1
you can do bunch of interfaces, that is allowed but inheritences? no. c++ can do bunch of inheritences though
29th Oct 2017, 9:50 PM
Gao Xiangshuai
Gao Xiangshuai - avatar