码迷,mamicode.com
首页 > Windows程序 > 详细

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

时间:2017-04-07 10:10:18      阅读:198      评论:0      收藏:0      [点我收藏+]

标签:src   rgs   信息   平台   战斗   summary   gif   close   alt   

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

技术分享
 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

标签:src   rgs   信息   平台   战斗   summary   gif   close   alt   

原文地址:http://www.cnblogs.com/qq2835200767/p/6676281.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!