zoukankan      html  css  js  c++  java
  • 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 }
    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
  • 相关阅读:
    Ubuntu下通过makefile生成静态库和动态库简单实例
    C++获取Windows7 32位系统中所有进程名(类似于任务管理器中的进程)
    剑指offer(一)
    Leetcode题解(一)
    C Run-Time Error R6034问题的解决
    windows环境中利用NMake工具编译连接C++源代码
    通过命令行使用cl.exe编译器
    [bzoj3709] [PA2014]Bohater
    [bzoj3714] [PA2014]Kuglarz
    [bzoj2724] [Violet 6]蒲公英
  • 原文地址:https://www.cnblogs.com/qq2835200767/p/6676281.html
Copyright © 2011-2022 走看看