c#基础知识 接口

接口实际上是一个约定

接口是抽象成员的集合

接口是一个引用类型,比抽象类更抽象

 

定义一个接口

public interface IStringList
{

void Add(string s);
int Count{get;}
string this[int index]{get;set;}

}

//public abstract 这个两个关键词不写出来

实现接口

class 类名:[父类,] 接口,接口
{
pulic 方法(){....}
}

 

posted @ 2016-12-19 10:42  星河mio  阅读(190)  评论(0编辑  收藏  举报