国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > C# > 正文

C#接口interface用法實例

2020-01-24 01:40:14
字體:
來源:轉載
供稿:網友

本文實例講述了C#接口interface用法。分享給大家供大家參考。具體如下:

using System;//example of interfacespublic class Animals{//simple interfaceinterface IAnimal { void Breathes();}//interfaces can inherent from other interfacesinterface IMammal : IAnimal { int HairLength();}//interfaces can implement other interfaces which implemented interfacesinterface IMarsupial : IMammal { int PouchSize();}//interfaces can implement many other interfacesinterface IGonerMammal : IMammal, IExtinct {}interface IExtinct { int HowLongExtinct();}//classes can implement multiple interfacespublic class TasmanianTiger : IGonerMammal, IMarsupial {public int PouchSize() { return 2; }public int HowLongExtinct() { return 28; }public int HairLength() { return 4; }public void Breathes() { }}  public static void Main(string[] args) { Console.Write("The Tasmanian Tiger has been extinct for {0} years", new TasmanianTiger().HowLongExtinct());  }}

希望本文所述對大家的C#程序設計有所幫助。

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 安塞县| 马鞍山市| 龙里县| 方山县| 新津县| 霍邱县| 丽水市| 化德县| 武功县| 凯里市| 永川市| 鄂托克前旗| 宝坻区| 娄底市| 九龙城区| 龙里县| 郴州市| 磐安县| 醴陵市| 吴川市| 鸡东县| 牟定县| 武城县| 鄂尔多斯市| 曲阳县| 高州市| 怀柔区| 罗平县| 石城县| 昌乐县| 探索| 苍溪县| 马公市| 河西区| 淳化县| 洮南市| 万载县| 揭西县| 马尔康县| 武邑县| 江安县|