0

I am wondering, why Java developers wouldn't add check for same signature in inherited methods (like they did for DEFAULT METHODS interfaces). To be more clear: If the interface is trying to extend two interfaces, that have default methods with same signature, the compiler will simply not allow to extend these interfaces. Why not to do such check for multiple inheritance for classes? That would solve all the problems with diamond death etc. One little check.

  • see: c++. it's hell, some of the complicated issues there. denying multiple inheritance is to make sure you dont shoot yourself in the foot! – vikingsteve Mar 13 '17 at 14:20
  • James Gosling will be sorry to hear that he was wrong to design the language that way in 1993. – duffymo Mar 13 '17 at 14:22
  • Let's take default methods in interfaces for instance. If your interfaces extends two interfaces with same signature - THE COMPILER do all the work and don't allow to crush with diamond death in the run-time. The point is - why not to add this check at compile time for all classes, and thus allow multiple inheritance - i guess, you will agree, that default interface methods are the same as simple classes methods. So, where is the duplication of my question? Or you just not read attentively? – Nick Matvienko Mar 13 '17 at 14:33

0 Answers0