Redian新闻
>
An interview question.Java interface
avatar
An interview question.Java interface# Java - 爪哇娇娃
S*t
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?
avatar
g*g
2
Because C++ is a mess and Java learns lesson out of it.

【在 S*******t 的大作中提到】
: 【 以下文字转载自 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?

avatar
S*t
3
maybe I should ask this question on C++ board...

【在 g*****g 的大作中提到】
: Because C++ is a mess and Java learns lesson out of it.
avatar
S*t
4
but you interviewed for a java position.
remember that.

【在 S*******t 的大作中提到】
: maybe I should ask this question on C++ board...
avatar
F*n
5
这个问题问得真弱智

【在 S*******t 的大作中提到】
: maybe I should ask this question on C++ board...
avatar
A*o
6
it's an easy question.

【在 F****n 的大作中提到】
: 这个问题问得真弱智
avatar
s*e
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 的大作中提到】
: maybe I should ask this question on C++ board...
avatar
S*t
8
the keypoint is: multi-inheritance cause a lot of problems.

keyword
is

【在 s***e 的大作中提到】
: 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.

avatar
s*e
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 的大作中提到】
: the keypoint is: multi-inheritance cause a lot of problems.
:
: keyword
: is

avatar
F*n
10
问得莫名其妙,“用”INTERFACE”和多继承一定矛盾吗,C++难道不用接口?

【在 A**o 的大作中提到】
: it's an easy question.
avatar
g*g
11
C++是没有接口这个概念,虽然你可以定义一个只有虚函数的母类。
另外很重要的是C++不是同根继承(所有java类继承Object类),
这也使得实现上产生困难。

【在 F****n 的大作中提到】
: 问得莫名其妙,“用”INTERFACE”和多继承一定矛盾吗,C++难道不用接口?
相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。