<分区>
为什么java默认所有方法都是virtual但不支持多重继承?为什么Java会出现菱形问题?
<分区>
为什么java默认所有方法都是virtual但不支持多重继承?为什么Java会出现菱形问题?
最佳答案
James Gosling (被称为 Java 之父)说:
JAVA omits many rarely used, poorly understood, confusing features of C++ that in our experience bring more grief than benefit. This primarily consists of operator overloading (although it does have method overloading), multiple inheritance, and extensive automatic coercions.
引用:http://javapapers.com/core-java/why-multiple-inheritance-is-not-supported-in-java/
所以根据他的说法,他们根本不想添加它,因为他们认为这是个坏主意。
附言使用多个接口(interface)与多重继承不同。
关于java - 为什么java不支持多重继承,虽然默认所有的java方法都是virtual?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19585757/