| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 4239 人关注过本帖
标题:[讨论]接口,回贴就给分
只看楼主 加入收藏
幻风幻云
Rank: 1
等 级:新手上路
帖 子:762
专家分:0
注 册:2005-1-14
收藏
得分:0 
以下是引用yushengou在2005-4-8 15:05:21的发言: 接口怎么在应用中用起来呢。 没有突破口,没有概念。不知道怎么用。 用了这个接口有什么好处啊
interface IFace { void ShowMyFace(); } 正如我所提到的,不能从这个定义实例化一个对象,但可以从它派生一个类。因此,该类必须实现ShowMyFace抽象方法: class CFace:IFace { public void ShowMyFace() { Console.WriteLine("implementation"); } } 这就是个应用的例子啊

2005-04-08 15:17
yushengou
Rank: 1
等 级:新手上路
帖 子:401
专家分:0
注 册:2005-3-30
收藏
得分:0 
interface IFace    // 定义一个接口
{
void ShowMyFace();  //返回一个私有的接口函数???
}

class CFace:IFace   //继承接口
{
public void ShowMyFace()   //返回一个公共的接口函数???
{
Console.WriteLine("implementation");
}
}
幻幻帮偶改改

我是初学者,希望大家能多多帮助我 /bbs/showimg.asp?BoardID=34&filename=2005-4/200542294030151.gif" border="0" onload="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" onmouseover="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {return true;} else {window.open('http://bbs./bbs/showimg.asp?BoardID=34&filename=2005-4/200542294030151.gif');}" onmousewheel="return imgzoom(this);" alt="" />
2005-04-08 15:18
幻风幻云
Rank: 1
等 级:新手上路
帖 子:762
专家分:0
注 册:2005-1-14
收藏
得分:0 
以下是引用yushengou在2005-4-8 15:18:48的发言: interface IFace // 定义一个接口 { void ShowMyFace(); //返回一个私有的接口函数??? //void 是表示不返回值, 这里是定义接口的一个方法 } class CFace:IFace //继承接口,这里应该叫做从接口派生一个类 { public void ShowMyFace() //返回一个公共的接口函数???类实现ShowMyFace抽象方法 { Console.WriteLine("implementation"); } } 幻幻帮偶改改

2005-04-08 15:24
yushengou
Rank: 1
等 级:新手上路
帖 子:401
专家分:0
注 册:2005-3-30
收藏
得分:0 
以下是引用幻风幻云在2005-4-8 15:15:04的发言: 这句话的意思是不是 一个接口可以派生好多类,这些类之间可以通过这个接口进行访问。与类的内部构造等无关?
你的理解,行为和类有什么区别啊

我是初学者,希望大家能多多帮助我 /bbs/showimg.asp?BoardID=34&filename=2005-4/200542294030151.gif" border="0" onload="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" onmouseover="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {return true;} else {window.open('http://bbs./bbs/showimg.asp?BoardID=34&filename=2005-4/200542294030151.gif');}" onmousewheel="return imgzoom(this);" alt="" />
2005-04-08 15:26
yushengou
Rank: 1
等 级:新手上路
帖 子:401
专家分:0
注 册:2005-3-30
收藏
得分:0 
幻幻你一次性给我100分算了。一条一条来多麻烦啊。

我是初学者,希望大家能多多帮助我 /bbs/showimg.asp?BoardID=34&filename=2005-4/200542294030151.gif" border="0" onload="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" onmouseover="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {return true;} else {window.open('http://bbs./bbs/showimg.asp?BoardID=34&filename=2005-4/200542294030151.gif');}" onmousewheel="return imgzoom(this);" alt="" />
2005-04-08 15:28
幻风幻云
Rank: 1
等 级:新手上路
帖 子:762
专家分:0
注 册:2005-1-14
收藏
得分:0 
行为应该是 类之间的访问 等活动

2005-04-08 15:28
幻风幻云
Rank: 1
等 级:新手上路
帖 子:762
专家分:0
注 册:2005-1-14
收藏
得分:0 
以下是引用yushengou在2005-4-8 15:28:18的发言: 幻幻你一次性给我100分算了。一条一条来多麻烦啊。
不行啊 我说过回贴都给 给完为止啊 给别人也留点

2005-04-08 15:30
幻风幻云
Rank: 1
等 级:新手上路
帖 子:762
专家分:0
注 册:2005-1-14
收藏
得分:0 
14楼和15给反了,幸亏是一个人,哈哈

[此贴子已经被作者于2005-4-8 15:33:38编辑过]



2005-04-08 15:32
yushengou
Rank: 1
等 级:新手上路
帖 子:401
专家分:0
注 册:2005-3-30
收藏
得分:0 
以下是引用幻风幻云在2005-4-8 15:28:59的发言: 行为应该是 类之间的访问 等活动
那么那句话的意思应该是: 接口是类访问行为的一个入口。就好比每个行为都有一个入口, 有了这个入口,类可以很容易得找到这个入口去访问这个行为。 你说这样理解行不我很怕羞

我是初学者,希望大家能多多帮助我 /bbs/showimg.asp?BoardID=34&filename=2005-4/200542294030151.gif" border="0" onload="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" onmouseover="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {return true;} else {window.open('http://bbs./bbs/showimg.asp?BoardID=34&filename=2005-4/200542294030151.gif');}" onmousewheel="return imgzoom(this);" alt="" />
2005-04-08 15:37
yushengou
Rank: 1
等 级:新手上路
帖 子:401
专家分:0
注 册:2005-3-30
收藏
得分:0 
以下是引用幻风幻云在2005-4-8 15:30:50的发言: 不行啊 我说过回贴都给 给完为止啊 给别人也留点
其实你给我100分才是明智的。 不然分去得更多,我也是为你想啊

我是初学者,希望大家能多多帮助我 /bbs/showimg.asp?BoardID=34&filename=2005-4/200542294030151.gif" border="0" onload="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" onmouseover="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {return true;} else {window.open('http://bbs./bbs/showimg.asp?BoardID=34&filename=2005-4/200542294030151.gif');}" onmousewheel="return imgzoom(this);" alt="" />
2005-04-08 15:39
快速回复:[讨论]接口,回贴就给分
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.013861 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved