首页 > 代码库 > S2T40.(深入.Net平台和C#编程)第四章.简答题5.李向阳.20170406

S2T40.(深入.Net平台和C#编程)第四章.简答题5.李向阳.20170406

---恢复内容开始---

技术分享
 1 ============巫师类=============
 2 using System;
 3 using System.Collections.Generic;
 4 using System.Linq;
 5 using System.Text;
 6 using System.Threading.Tasks;
 7 
 8 namespace J5.entity
 9 {
10     /// <summary>
11     ///巫师类
12     /// </summary>
13    public  class WS
14     {
15         public string   Jibie { get; set; } //级别
16         public int Zhandou { get; set; }  //战斗力
17         public int ShenMing { get; set; }  //生命值
18        /// <summary>
19        /// 构一
20        /// </summary>
21         public  WS()
22         {
23             this.ShenMing = 10000;
24         }
25        /// <summary>
26        /// 构二
27        /// </summary>
28        /// <param name="jb"></param>
29        /// <param name="zdl"></param>
30        /// <param name="sm"></param>
31        public WS(string jb, int zdl, int sm)
32         {
33             this.Jibie = jb;
34             this.Zhandou = zdl;
35             this.ShenMing = sm;
36         }
37       
38        /// <summary>
39        /// 显示信息
40        /// </summary>
41        public void Info()
42        {
43            Console.WriteLine("巫师的级别为:{0},战斗力为:{1},生命值为:{2}", Jibie, Zhandou, ShenMing);
44        }
45     }
46 }
View Code
技术分享
 1 ===========测试类===========
 2 using System;
 3 using System.Collections.Generic;
 4 using System.Linq;
 5 using System.Text;
 6 using System.Threading.Tasks;
 7 using J5.entity;
 8 
 9 namespace J5
10 {
11     class Program
12     {
13         static void Main(string[] args)
14         {
15             WS ws = new WS();   
16             ws.Jibie = "中级";  //级别
17             ws.Zhandou = 2000;  //战斗力
18             ws.Info();
19             Console.WriteLine();
20             WS ws1 = new WS("中级",5000,99999);
21             ws1.Info();
22             Console.Read();
23           
24         }
25     }
26 }
View Code

 

S2T40.(深入.Net平台和C#编程)第四章.简答题5.李向阳.20170406