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