最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

C#接口interface用法實例

 更新時間:2015年06月29日 14:41:50   作者:pythoner  
這篇文章主要介紹了C#接口interface用法,實例分析了C#接口的基本使用方法,需要的朋友可以參考下

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

using System;
//example of interfaces
public class Animals
{
//simple interface
interface IAnimal {
 void Breathes();
}
//interfaces can inherent from other interfaces
interface IMammal : IAnimal {
 int HairLength();
}
//interfaces can implement other interfaces which implemented interfaces
interface IMarsupial : IMammal {
 int PouchSize();
}
//interfaces can implement many other interfaces
interface IGonerMammal : IMammal, IExtinct {
}
interface IExtinct {
 int HowLongExtinct();
}
//classes can implement multiple interfaces
public 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#程序設計有所幫助。

相關文章

最新評論

封丘县| 凌源市| 富裕县| 增城市| 开封县| 阳新县| 铅山县| 平原县| 永嘉县| 抚州市| 栾川县| 浙江省| 怀来县| 余江县| 彩票| 略阳县| 黎平县| 京山县| 闸北区| 佛学| 兴城市| 田阳县| 尤溪县| 安国市| 忻城县| 泾阳县| 浙江省| 孟津县| 达孜县| 石台县| 杂多县| 巴彦县| 贺州市| 汶川县| 皮山县| 广德县| 宿州市| 潼南县| 衡水市| 平湖市| 姜堰市|