zoukankan      html  css  js  c++  java
  • 深入.NET平台和C#编程.第四章:深入类的方法.简答题5

    ------------------------------------------SoClass类--------------------------------------------

     1 using System;
     2 using System.Collections.Generic;
     3 using System.Linq;
     4 using System.Text;
     5 using System.Threading.Tasks;
     6 
     7 namespace Sorcerer
     8 {
     9     public class SoClass
    10     {
    11         public int Jb { get; set; }
    12         public int Zdl { get; set; }
    13         public int Smz { get; set; }
    14 
    15         public SoClass(int smz)
    16         {
    17             this.Smz = smz;
    18             Console.WriteLine("巫师的生命值为:" + smz);
    19         }
    20 
    21         public SoClass(int jb, int zdl,int smz)
    22         {
    23             this.Jb = jb;
    24             this.Zdl = zdl;
    25             this.Smz = smz;
    26 
    27             Console.WriteLine("巫师级别为:{0},战斗力为:{1},生命值为:{2}",jb , zdl , smz);
    28         }
    29 
    30     }
    31 }
    View Code

    ------------------------------------------Main()方法--------------------------------------------

     1 using System;
     2 using System.Collections.Generic;
     3 using System.Linq;
     4 using System.Text;
     5 using System.Threading.Tasks;
     6 
     7 namespace Sorcerer
     8 {
     9     class Program
    10     {
    11         static void Main(string[] args)
    12         {
    13             SoClass sc = new SoClass(10000);
    14 
    15             SoClass scl = new SoClass(6666 , 8888 , 10000);
    16 
    17             Console.ReadLine();
    18         }
    19     }
    20 }
    View Code

    ------------------------------------------运行结果----------------------------------------------

  • 相关阅读:
    在 Ubuntu上使用 MySQL
    Ubuntu/CentOs 搭建SVN服务器
    一个简单的零配置命令行HTTP服务器
    Windows 环境下 NodeJs 开发 Log
    AngularJS
    thinkphp5.0使用workerman多线程实例
    bat自动备份数据库文件
    mysql.ini配置优化速度参考
    php解析识别二维码内容
    windows屏蔽windows错误报告提示框
  • 原文地址:https://www.cnblogs.com/chenhui666/p/6676034.html
Copyright © 2011-2022 走看看