首页 > 代码库 > S2T40.(深入.Net平台和C#编程)第四章.简答题5.刁汉生.20170406
S2T40.(深入.Net平台和C#编程)第四章.简答题5.刁汉生.20170406
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 }
S2T40.(深入.Net平台和C#编程)第四章.简答题5.刁汉生.20170406
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。