S*******t 发帖数: 97 | 1 【 以下文字转载自 JobHunting 讨论区 】
发信人: Serverlet (M$), 信区: JobHunting
标 题: An interview question.Java interface
发信站: BBS 未名空间站 (Mon Sep 15 11:24:10 2008), 站内
why java use interface while c++ keeps multiple inheritance? |
g*****g 发帖数: 34805 | 2 Because C++ is a mess and Java learns lesson out of it.
【在 S*******t 的大作中提到】![](/moin_static193/solenoid/img/up.png) : 【 以下文字转载自 JobHunting 讨论区 】 : 发信人: Serverlet (M$), 信区: JobHunting : 标 题: An interview question.Java interface : 发信站: BBS 未名空间站 (Mon Sep 15 11:24:10 2008), 站内 : why java use interface while c++ keeps multiple inheritance?
|
S*******t 发帖数: 97 | 3 maybe I should ask this question on C++ board...
【在 g*****g 的大作中提到】![](/moin_static193/solenoid/img/up.png) : Because C++ is a mess and Java learns lesson out of it.
|
S*********t 发帖数: 78 | 4 but you interviewed for a java position.
remember that.
【在 S*******t 的大作中提到】![](/moin_static193/solenoid/img/up.png) : maybe I should ask this question on C++ board...
|
F****n 发帖数: 3271 | 5 这个问题问得真弱智
【在 S*******t 的大作中提到】![](/moin_static193/solenoid/img/up.png) : maybe I should ask this question on C++ board...
|
A**o 发帖数: 1550 | 6 it's an easy question.
【在 F****n 的大作中提到】![](/moin_static193/solenoid/img/up.png) : 这个问题问得真弱智
|
s***e 发帖数: 122 | 7 just say whatever you know about interface, such as: interface is a keyword
and first-class member in Java; Program to interface not to class; Prefer
interface inheritance to implementation inheritance. In short, interface is
a much better solution than multiple inheritance, Java learned the lesson.
【在 S*******t 的大作中提到】![](/moin_static193/solenoid/img/up.png) : maybe I should ask this question on C++ board...
|
S*********t 发帖数: 78 | 8 the keypoint is: multi-inheritance cause a lot of problems.
keyword
is
【在 s***e 的大作中提到】![](/moin_static193/solenoid/img/up.png) : just say whatever you know about interface, such as: interface is a keyword : and first-class member in Java; Program to interface not to class; Prefer : interface inheritance to implementation inheritance. In short, interface is : a much better solution than multiple inheritance, Java learned the lesson.
|
s***e 发帖数: 122 | 9 well, the keypoint is you will be asked to give detailed explanation. I am
talking about how you could answer this question in an interview. now you
are in the position to explain what the problems are.
【在 S*********t 的大作中提到】![](/moin_static193/solenoid/img/up.png) : the keypoint is: multi-inheritance cause a lot of problems. : : keyword : is
|
F****n 发帖数: 3271 | 10 问得莫名其妙,“用”INTERFACE”和多继承一定矛盾吗,C++难道不用接口?
【在 A**o 的大作中提到】![](/moin_static193/solenoid/img/up.png) : it's an easy question.
|
g*****g 发帖数: 34805 | 11 C++是没有接口这个概念,虽然你可以定义一个只有虚函数的母类。
另外很重要的是C++不是同根继承(所有java类继承Object类),
这也使得实现上产生困难。
【在 F****n 的大作中提到】![](/moin_static193/solenoid/img/up.png) : 问得莫名其妙,“用”INTERFACE”和多继承一定矛盾吗,C++难道不用接口?
|