<output id="qn6qe"></output>

    1. <output id="qn6qe"><tt id="qn6qe"></tt></output>
    2. <strike id="qn6qe"></strike>

      亚洲 日本 欧洲 欧美 视频,日韩中文字幕有码av,一本一道av中文字幕无码,国产线播放免费人成视频播放,人妻少妇偷人无码视频,日夜啪啪一区二区三区,国产尤物精品自在拍视频首页,久热这里只有精品12

      e媒網(wǎng)絡(luò)

      一切皆可能 e媒網(wǎng)絡(luò) http://www.eMay.net

      博客園 首頁 新隨筆 聯(lián)系 訂閱 管理

      協(xié)變參考代碼1:

      using System;
      using System.Collections.Generic;
      using System.Linq;
      
      namespace CovarianceSoOnDemo2
      {
          public class Pet
          {
              protected bool _bPutOn;
              protected string _name;
              public Pet(string name)
              {
                  _name = name;
              }
              public void PutOn()
              {
                  _bPutOn = true;         
              }
              public void ShowMe()
              {
                  string strPutOn = _bPutOn ? "穿衣的" : "";
                  Console.WriteLine(_name + ":"+strPutOn+"小可愛");
              }
          }
          public class Cat : Pet
          {
      
              public Cat(string name) : base(name)
              {
      
              }
              public void CatchMouse()
              {
                  Console.WriteLine(_name + ":我會抓老鼠");
              }
          }
      
          public interface IIndex<out T>
          {
              T this[int index] { get; }
              int Count { get; }
          }
      
          public class CatCollection : IIndex<Cat>
          {
              private Cat[] _data;
              public CatCollection(Cat[] data)
              {
                  _data = data;
              }
              public Cat this[int index]
              {
                  get
                  {
                      if (index < 0 || index > _data.Length)
                          throw new ArgumentOutOfRangeException("index");
                      return _data[index];
                  }
              }        
              public int Count
              {
                  get
                  {
                      return _data.Length;
                  }
              }
          }
          class Program
          {
              static void Main(string[] args)
              {
                  Cat[] catArr = new Cat[3] {
                      new Cat("傻貓1"),
                      new Cat("傻貓2"),
                      new Cat("傻貓3")
                  };
                  IIndex<Cat> cats = new CatCollection(catArr);
                  IIndex<Pet> pets = cats; 
                 for(int i=0;i<pets.Count;i++)
                  {
                      pets[i].ShowMe();
                  }
                  for (int i = 0; i < pets.Count; i++)
                  {
                      pets[i].PutOn();
                  }
                  for (int i = 0; i < pets.Count; i++)
                  {
                      pets[i].ShowMe();
                      ((Cat)pets[i]).CatchMouse();
                  }
              }
          }
      }

       協(xié)變參考代碼2:

      using System;
      
      namespace CovarianceSoOnDemo
      {
          public class Shape
          {
              public double Width { set; get; }
              public double Height { set; get; }
              public override string ToString()
              {
                  return string.Format("Width:{0},Height:{1}", Width, Height);
              }
          }
          public class Rectangle : Shape { }
          public interface IIndex<out T>
          {
              T this[int index] { get; }
              int Count { get; }
          }
          public class RectangleCollection : IIndex<Rectangle>
          {
              private Rectangle[] data = new Rectangle[3]
              {
                  new Rectangle{Height=2,Width=5},
                  new Rectangle{Height=3,Width=7},
                  new Rectangle{Height=4,Width=2.9}
              };
              public Rectangle this[int index]
              {
                  get
                  {
                      if (index < 0 || index > data.Length)
                          throw new ArgumentOutOfRangeException("index");
                      return data[index];
                  }
              }
              public static  RectangleCollection GetRectangles()
              {
                  return new RectangleCollection();
              }
              public int Count
              {
                  get
                  {
                      return data.Length;
                  }
              }
          }
          class Program
          {
              static void Main(string[] args)
              {
      
                  IIndex<Rectangle> rectangles = RectangleCollection.GetRectangles();
                  //IIndex<Rectangle> rectangles = new RectangleCollection();
                  IIndex<Shape> shapes = rectangles;
                  for (int i = 0; i < shapes.Count; i++)
                  {
                      Console.WriteLine(shapes[i]);
                  }
              }
          }
      }

       

      posted on 2022-12-15 12:54  e媒網(wǎng)絡(luò)技術(shù)團隊  閱讀(31)  評論(0)    收藏  舉報
      主站蜘蛛池模板: 欧美一本大道香蕉综合视频| 久久精品色妇熟妇丰满人| 人人妻人人澡人人爽人人精品电影| 香蕉影院在线观看| 国产精品一码在线播放| 成人午夜在线观看日韩| 爽爽精品dvd蜜桃成熟时电影院| 久久亚洲欧美日本精品| 亚洲自拍偷拍一区二区三区 | 国产精品自在自线免费观看| 日韩精品无码一区二区视频| 国产麻豆9l精品三级站| 亚洲国产性夜夜综合| 亚洲AV永久无码天堂网一线| 亚洲va久久久噜噜噜久久狠狠| 免费视频欧美无人区码| 国产精品美女网站| 日本边添边摸边做边爱喷水| 成人性无码专区免费视频| 国产精品自拍一二三四区| 无码抽搐高潮喷水流白浆| 人妻无码中文字幕| 粗大挺进朋友人妻淑娟| 石渠县| 男人的天堂av社区在线| 亚洲 一区二区 在线| 无遮挡aaaaa大片免费看| 亚洲国产精品成人av网| 一区二区不卡99精品日韩| 国产av剧情无码精品色午夜| 亚洲欧美日韩综合久久久| 亚洲国产精品综合久久20| 国产99久久无码精品| 日本一区二区不卡精品| 国产一区二区三区国产视频 | 国产精品成人午夜福利| 亚洲区日韩精品中文字幕| 四虎精品国产永久在线观看| 高清自拍亚洲精品二区| 国产av丝袜熟女一二三| 熟女人妻视频|