主题:接口的概念
黑客阿川
[专家分:0] 发布于 2007-12-09 18:55:00
我是刚开始学的,看了很多边视频,也参考了很多资料,就是不太理解接口的概念.
回复列表 (共2个回复)
沙发
shandian534 [专家分:560] 发布于 2007-12-09 20:52:00
我不知道你想问什么问题,
接口,
1、可以理解为一个公共的协议.
2、利用接口可以实现多继承
板凳
justforfun626 [专家分:18460] 发布于 2007-12-10 01:11:00
[quote]
Q. Why do we need interface?
A: This is an OO concepts, we define a protocol, then we can use it by contract, we don't care what is the implementation.
Here is a commonplace example to illustrate the concepts. We have the PCI board in our computer, which define the interface, then all your SoundCard, GraphicsCard, etc. as long as they implement the interface, they are OK to plugin. Some illustrative sample code follows.
[/quote]
copied from
[url]http://bobcat.webappcabaret.net/javachina/faq/04.htm#abs_Q020[/url]
我来回复