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

S2T40.(深入.Net平台和C#编程)第四章.简答题5.刁汉生.20170406

时间:2017-04-06 23:20:28      阅读:314      评论:0      收藏:0      [点我收藏+]

标签:hid   gif   generic   inf   color   lap   his   code   win   

技术分享
 1 using System;
 2 using System.Collections.Generic;
 3 using System.Linq;
 4 using System.Text;
 5 using System.Threading.Tasks;
 6 
 7 namespace 简答题5.Entity
 8 {
 9     /// <summary>
10     /// 巫师类
11     /// </summary>
12     public class Wizard
13     {
14         /// <summary>
15         /// 等级
16         /// </summary>
17         public int Level { get; set; }
18         /// <summary>
19         /// 战斗力
20         /// </summary>
21         public int zdl { get; set; }
22         /// <summary>
23         /// 生命值
24         /// </summary>
25         public int HP { get; set; }
26         public Wizard()
27         {
28             HP = 10000;
29         }
30         public Wizard(int level, int zdl, int hp)
31         {
32             this.Level = level;
33             this.zdl = zdl;
34             this.HP = hp;
35         }
36         /// <summary>
37         /// 展示信息
38         /// </summary>
39         public void showInfo()
40         {
41             Console.WriteLine("巫师!级别:{0},战斗力:{1},生命值:{2}",Level,zdl,HP);
42         }
43     }
44 }
巫师类
技术分享
 1 using System;
 2 using System.Collections.Generic;
 3 using System.Linq;
 4 using System.Text;
 5 using System.Threading.Tasks;
 6 using 简答题5.Entity;
 7 
 8 namespace 简答题5
 9 {
10     class Program
11     {
12         static void Main(string[] args)
13         {
14             Wizard w = new Wizard();
15             w.Level = 10;
16             w.zdl = 5000;
17             w.showInfo();
18             Console.WriteLine();
19             Wizard w1 = new Wizard(10,6000,99999);
20             w1.showInfo();
21             Console.ReadLine();
22         }
23     }
24 }
Main方法

 

S2T40.(深入.Net平台和C#编程)第四章.简答题5.刁汉生.20170406

标签:hid   gif   generic   inf   color   lap   his   code   win   

原文地址:http://www.cnblogs.com/hanss/p/6675913.html

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