1.都是“虚的”不能被实例化,这也是接口中为什么不能包含字段、成员变量的原因
3.都具有模板的性质,如果一个接口或者类从某一个接口继承,它将自动具有被集成者的特征(包括索引,属性,函数,实践等).
4.接口支持多重继承,而C#中,类之支持单一继承,接口实际表示的是一种承载能力,
下面是接口的一个简单定义:
interface SampInterface1
{
string this[ int index]
{
get
set
} ;
void Find( int value );
//注意此处没有
{
}
string Point
{
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)
{
}
















