码迷,mamicode.com
首页 > 其他好文 > 详细

2017.4.6课后作业(第四章.简答题5)

时间:2017-04-07 00:38:44      阅读:151      评论:0      收藏:0      [点我收藏+]

标签:ace   mat   lin   技术分享   thread   技术   blog   line   ram   

技术分享
 1 using System;
 2 using System.Collections.Generic;
 3 using System.Linq;
 4 using System.Text;
 5 using System.Threading.Tasks;
 6 
 7 namespace lesson5.entity
 8 {
 9     /// <summary>
10     /// 巫师
11     /// </summary>
12     class Wizard
13     {
14 
15         public Wizard(int grade, int fighting, int vitality)
16         {
17             this.Grade = grade;
18 
19             this.Fighting = fighting;
20 
21             this.Vitality = vitality;
22         }
23 
24         /// <summary>
25         /// 级别
26         /// </summary>
27         public int Grade{get;set;}
28 
29         /// <summary>
30         /// 战斗力
31         /// </summary>
32         public int Fighting{get;set;}
33 
34         /// <summary>
35         /// 生命力
36         /// </summary>
37         public int Vitality{get;set;}
38         public Wizard()
39         {
40             this.Vitality = 10000;
41         }
42 
43         /// <summary>
44         /// 信息
45         /// </summary>
46         public void Information()
47         {
48             Console.WriteLine("巫师!级别:{0},战斗力:{1},生命值:{2}",Grade,Fighting,Vitality);
49         }
50     }
51 }
View Code
技术分享
 1 using System;
 2 using System.Collections.Generic;
 3 using System.Linq;
 4 using System.Text;
 5 using System.Threading.Tasks;
 6 using lesson5.entity;
 7 
 8 namespace lesson5
 9 {
10     class Program
11     {
12         static void Main(string[] args)
13         {
14            
15             Wizard wd = new Wizard();
16             wd.Grade = 10;
17             wd.Fighting = 3000;
18             wd.Information();
19 
20             Wizard wd1 = new Wizard(10,3000,20000);
21             wd1.Information();
22             Console.ReadLine();
23         }
24     }
25 }
View Code

 

2017.4.6课后作业(第四章.简答题5)

标签:ace   mat   lin   技术分享   thread   技术   blog   line   ram   

原文地址:http://www.cnblogs.com/weiai520/p/6676160.html

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