重载

 1 using System;
 2 using System.Collections.Generic;
 3 using System.Linq;
 4 using System.Text;
 5 using System.Threading.Tasks;
 6 
 7 namespace kk5
 8 {
 9   public   class SS
10     {
11       public SS(int sheng) 
12       {
13           this.Sheng = sheng;
14           Console.WriteLine("生命值"+ sheng);
15       }
16       public SS(int jj,int zhan,int zhi)
17       {
18           this.Zhan = zhan;
19           this.Zhi = Zhi;
20           this.Jj = jj;
21           Console.WriteLine("级别" + jj);
22       }
23 
24       public int Sheng { get; set; }
25       public int Jj { get; set; }
26       public int  Zhan { get; set; }
27       public int  Zhi { get; set; }
28     }
29 }
View Code
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace kk5
{
    class Program
    {
        static void Main(string[] args)
        {
            SS s = new SS(1000);
            SS ss = new SS(100,111,999);
        }
        
    }
}

 

posted @ 2017-04-06 23:23  南城。  阅读(116)  评论(0编辑  收藏  举报