2.17

来源:互联网 发布:网络协查函怎么开 编辑:程序博客网 时间:2024/04/30 10:47

           1、构造函数的调用顺序是先调用System.Object,再按照层次结构由上向下进行,直到到达编译器要实例化的类为止  

                 public abstract class GenericCustomer

   {

      private string name;

      public GenericCustomer()

         : base()  // we could omit this line without affecting the compiled code

      {

         name = "<no name>";

      }

class Nevermore60Customer : GenericCustomer

{

   private uint highCostMinutesUsed;

   // other methods etc.

}

2、

   abstract class GenericCustomer

   {

      private string name;

      public GenericCustomer(string name)

      {

         this.name = name;

      }

class Nevermore60Customer : GenericCustomer

{

   private string referrerName;

    public Nevermore60Customer(string name)

         : this(name, "<None>")

      {     }

  public Nevermore60Customer(string name, string referrerName)

         : base(name)

      {

         this.referrerName = referrerName;

      }

}

      private uint highCostMinutesUsed;

 
原创粉丝点击