摘要: 构造函数: 构造函数 - 创建一个类的函数 每一个类都有构造函数,访问修饰符必须是public的,并且不需要写任何返回值,方法名与类名一致 自己写的类 - 用户自定义类型如果要使用自定义类型产生出来的 对象 必须有一个实例化的过程 实例化格式:类型名 ss = new 构造函数(); 访问修饰符 - 阅读全文
posted @ 2016-11-26 23:18 吴皓杰 阅读(143) 评论(0) 推荐(0) 编辑
摘要: 我们先封装一个叫做战士的类 using System;using System.Collections.Generic;using System.Linq;using System.Text; namespace 对战游戏{ public class Soldier { //名字,生命值,攻击力,招 阅读全文
posted @ 2016-11-26 23:15 吴皓杰 阅读(233) 评论(0) 推荐(0) 编辑
摘要: using System;using System.Collections.Generic;using System.Linq;using System.Text; namespace 推箱子{ class Program { static void Main(string[] args) { // 阅读全文
posted @ 2016-11-26 23:09 吴皓杰 阅读(240) 评论(0) 推荐(0) 编辑