精品丰满熟女一区二区三区_五月天亚洲欧美综合网_亚洲青青青在线观看_国产一区二区精选

  • <menu id="29e66"></menu>

    <bdo id="29e66"><mark id="29e66"><legend id="29e66"></legend></mark></bdo>

  • <pre id="29e66"><tt id="29e66"><rt id="29e66"></rt></tt></pre>

      <label id="29e66"></label><address id="29e66"><mark id="29e66"><strike id="29e66"></strike></mark></address>
      學(xué)習(xí)啦 > 學(xué)習(xí)英語 > 專業(yè)英語 > 計算機英語 > c中base的用法

      c中base的用法

      時間: 長思709 分享

      c中base的用法

        c中base的用法的用法你知道嗎?下面小編就跟你們詳細(xì)介紹下c中base的用法的用法,希望對你們有用。

        c中base的用法的用法如下:

        1、調(diào)用基類中的重名方法

        [csharp]

        public class Person

        {

        protected string ssn = "444-55-6666";

        protected string name = "John L. Malgraine";

        public virtual void GetInfo()

        {

        Console.WriteLine("Name: {0}", name);

        Console.WriteLine("SSN: {0}", ssn);

        }

        }

        class Employee : Person

        {

        public string id = "ABC567EFG";

        public override void GetInfo()

        {

        // Calling the base class GetInfo method:

        base.GetInfo();

        Console.WriteLine("Employee ID: {0}", id);

        }

        }

        class TestClass

        {

        static void Main()

        {

        Employee E = new Employee();

        E.GetInfo();

        }

        }

        /*

        Output

        Name: John L. Malgraine

        SSN: 444-55-6666

        Employee ID: ABC567EFG

        */

        2、調(diào)用基類的構(gòu)造方法

        [csharp]

        ublic class ActionCancelEventArgs : System.ComponentModel.CancelEventArgs

        {

        public ActionCancelEventArgs() : this(false) {}

        public ActionCancelEventArgs(bool cancel) : this(false, String.Empty) {}

        public ActionCancelEventArgs(bool cancel, string message) : base(cancel)

        {

        this.message = message;

        }

        public string Message{ get; set;}

        }

      熱門文章

      537053