0

Why Java doesn't support Multiple inheritance, tuple, and operator overloading.

13th May 2017, 9:11 PM
Hamza Ahmed Khan
Hamza Ahmed Khan - avatar
5 Antworten
+ 11
Java doesn't support multiple inheritance of a classes to avoid ambiguity, when the methods signatures of the inherited classes match
13th May 2017, 9:45 PM
Alexey
Alexey - avatar
+ 6
Multiple inheritance is likely not supported because of the Diamond Problem. This problem occurs if you have a sub class inheriting 2 classes that each inherit some base class. The 2 classes both override the same method from the base class. Now you call the overrided method from the bottom class. Which method will run out of the 2 inherited classes? Idk. That's the problem with multiple inheritance, which is a potential reason why Java decided to avoid it.
14th May 2017, 3:43 AM
Rrestoring faith
Rrestoring faith - avatar
+ 3
thats just how java was designed. at least you can implement more than one interface
13th May 2017, 9:15 PM
Edward
+ 1
@Alexy thanks
13th May 2017, 10:08 PM
Hamza Ahmed Khan
Hamza Ahmed Khan - avatar
0
Yup, it does support multiple interfaces, but there has to be some architectural reason. Why they designed it like that. Just curiosity!!
13th May 2017, 9:21 PM
Hamza Ahmed Khan
Hamza Ahmed Khan - avatar