继承 ,构造方法使用

 1  class MortimerPhones
 2     {
 3         static void Main(string[] args)
 4         {
 5             Nevermore60Customer nc = new Nevermore60Customer("Peter");
 6 
 7             Console.WriteLine();
 8             Console.ReadLine();
 9         }
10     }
11 
12     public abstract class GenericCustomer
13     {
14         private string name;
15         private int age;
16         public GenericCustomer()
17             : base()
18         {
19             name = "<no name>";
20             age = 18;
21         }
22         public GenericCustomer(string name)
23         {
24             this.name = name;
25         }
26     }
27     class Nevermore60Customer : GenericCustomer
28     {
29         private string referrerName;
30         private int highcostMinutesUsed;
31          
32 
33         public Nevermore60Customer(string name, string referrerName)
34             : base(name)
35         {
36             this.referrerName = referrerName;
37         }
38 
39         public Nevermore60Customer(string name)
40             : this(name, "<None>")
41         {
42 
43         }
44     }

 

posted @ 2016-10-09 14:18  指间的徘徊  阅读(134)  评论(0编辑  收藏  举报