It's drilled into the newbie Java programmers that Java has no multiple class inheritance, and only multiple interface inheritance, because otherwise you run into diamond inheritance problem (Class A inherits from classes B and C, both of which implement method X. So which of those classes' implementation is used when you do a.X() call?)
Clearly, C++ successfully addressed this, since it has multiple inheritance.
What's different between the internal design of Java and C++ - (i'm guessing in the method dispatch methodology) that allows this problem to be solved in C++ but prevents in Java?
Aucun commentaire:
Enregistrer un commentaire