乡下人产国偷v产偷v自拍,国产午夜片在线观看,婷婷成人亚洲综合国产麻豆,久久综合给合久久狠狠狠9

  • <output id="e9wm2"></output>
    <s id="e9wm2"><nobr id="e9wm2"><ins id="e9wm2"></ins></nobr></s>

    • 分享

      抽象類和接口(抽象類部分實(shí)現(xiàn),接口隱式實(shí)現(xiàn))

       空城66 2014-12-15
      namespace 接口和抽象類
      {
          /// <summary>
          /// 載客
          /// </summary>
          interface IpassengerCarrierable
          {
              void Passenger();        
          }
          /// <summary>
          /// 載貨
          /// </summary>
          interface IHeavyLoadCarrierable
          {
              void Cargo();
          }
          /// <summary>
          /// 車(chē)類
          /// </summary>
          abstract class Vehicle
          {
              public string Color { get; set; }
              public string Type { get; set; }
              public double Money { get; set; }
              public abstract void Start();
              public abstract void Run();
              public abstract void Stop();
              public void CanRunInRoad()
              {
                  Console.WriteLine("該工具正行駛在公路上!");
              }
          }
          abstract class Car : Vehicle
          {
              public override void Start()
              {
                  Console.WriteLine("該轎車(chē)正在啟動(dòng)中!");
              }
              public override void Run()
              {
                  Console.WriteLine("該轎車(chē)正在行駛中!");
              }
              public override void Stop()
              {
                  Console.WriteLine("該轎車(chē)正在拋錨中!");
              }
          }
          abstract class Train : Vehicle
          {
              public override void Start()
              {
                  Console.WriteLine("火車(chē)發(fā)動(dòng)中!");
              }
              public override void Run()
              {
                  Console.WriteLine("火車(chē)運(yùn)行中!");
              }
              public override void Stop()
              {
                  Console.WriteLine("火車(chē)停止運(yùn)行了!");
              }
          }
          class Compact : Car,IpassengerCarrierable
          {
              public void Passenger()
              {
                  Console.WriteLine("小polo正在載客!");
              }
          }
          class FreightTrain : Train, IHeavyLoadCarrierable
          {
              public void Cargo()
              {
                  Console.WriteLine("該趟列車(chē)正在載貨中!");
              }
          }
          class Program
          {
              static void Main(string[] args)
              {
                 Compact c= new Compact();
                  c.Color = "黃色";
                  c.Type = "緊湊型小polo";
                  c.Money = 120000;
                  Console.WriteLine("這輛{0}{1}大概{2}錢(qián),",c.Color ,c.Type ,c.Money);
                  c.CanRunInRoad();
                  c.Start();            
                  c.Run();
                  c.Passenger();
                  c.Stop();
                  Console.WriteLine();
                  FreightTrain f = new FreightTrain();
                  f.Color = "綠色";
                  f.Type = "載貨列車(chē)";
                  f.Money = 1000000;
                  Console.WriteLine("這輛{0}{1}大概{2}錢(qián),", f.Color, f.Type, f.Money);
                  f.Start();
                  f.Run();
                  f.Cargo();
                  f.Stop();
                  Console.ReadKey();
              }
          }
      }

        本站是提供個(gè)人知識(shí)管理的網(wǎng)絡(luò)存儲(chǔ)空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點(diǎn)。請(qǐng)注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購(gòu)買(mǎi)等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊一鍵舉報(bào)。
        轉(zhuǎn)藏 分享 獻(xiàn)花(0

        0條評(píng)論

        發(fā)表

        請(qǐng)遵守用戶 評(píng)論公約

        類似文章 更多