惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

H
Help Net Security
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
博客园 - 【当耐特】
Microsoft Azure Blog
Microsoft Azure Blog
Google DeepMind News
Google DeepMind News
Apple Machine Learning Research
Apple Machine Learning Research
有赞技术团队
有赞技术团队
Y
Y Combinator Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
爱范儿
爱范儿
L
LangChain Blog
IT之家
IT之家
酷 壳 – CoolShell
酷 壳 – CoolShell
MongoDB | Blog
MongoDB | Blog
Hugging Face - Blog
Hugging Face - Blog
G
Google Developers Blog
T
Tailwind CSS Blog
Engineering at Meta
Engineering at Meta
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
宝玉的分享
宝玉的分享
博客园 - 三生石上(FineUI控件)
D
DataBreaches.Net
Recent Announcements
Recent Announcements
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More

博客园 - 释天

4年后新的开始 flash make things move 电子书 破解pubwin ep html学习笔记(-) js学习笔记(-) - 释天 - 博客园 flex2注册码 Flex2.0和C#间的通信[转] - 释天 - 博客园 flash与.net的联合开发(c#,c++)请大家讨论一下 flash中三维动画学习(关于类) flash中一个二维的类 经典言论 c#解答题参考答案 [求教]vs2005下关于css的问题 一个关于文件操作的类(功能还是有点弱) 写了个烂代码,请原谅 赠送gmail邀请 三个范式的解释 Gridview的使用 iframe的使用
C#中接口(interface)的理解
释天 · 2006-09-23 · via 博客园 - 释天

C#中的接口
1.都是“虚的”不能被实例化,这也是接口中为什么不能包含字段--成员变量的原因2.正因为接口是虚的,所以接口内的索引,属性,时间等只能有声明,而不能在接口内实现,具体如何实现是派生接口或者派生类的事.
3.都具有模板的性质,如果一个接口或者类从某一个接口继承,它将自动具有被集成者的特征(包括索引,属性,函数,实践等).
4.接口支持多重继承,而C#中,类之支持单一继承,接口实际表示的是一种承载能力,
下面是接口的一个简单定义:

interface
SampInterface1
{
    
string 
    
thisint index]
    
{
        
get;
        
set
    }

    ;
    
event EventHandler Event;
    
void  Find( int value );
    
//注意此处没有
    {
    }

    
    
string Po
    
int
    
{
        
get;
        
set
    }

    ;
}

上面的接口定义了一个索引
this,一个实践Event,一个方法Find和一个属性Point.

public interface SampIneterface:SampIneterface1
pravite  
int a=1;
void find (int value)
{
a
+=value;
}

event EventHandler Event;
protected void onEvent()
{
if(Event=null)
{return Event(this.System.EventAgrs.Empty;)}
}


}