摘要: using System;using System.Collections.Generic;using System.Linq;using System.Text;//Red Gate's Reflector 反编译工具namespace _5属性2{ class Program { static void Main(string[] args) { //Person5 p = new Person5(); //p.Age = 30; //Console.WriteLine(p.Age);... 阅读全文
posted @ 2012-02-23 23:53 简单--生活 阅读(181) 评论(0) 推荐(0) 编辑
摘要: using System;using System.Collections.Generic;using System.Linq;using System.Text;/* 面向对像版聊天机器人 * 机器人有不同的名字,维护自己的FullLevel,可以SayHello,可以喂食,可以对它说话(Speak),对异常情况(错误的喂饭数字,喂养的太多撑死了)进行处理,有两个机器人供选择,一开始通过1 2 数字选择聊天机器人 * * */namespace _4练习聊天机器人{ class Program { static void Main(string[] args) ... 阅读全文
posted @ 2012-02-23 23:35 简单--生活 阅读(436) 评论(0) 推荐(0) 编辑
摘要: using System;using System.Collections.Generic;using System.Linq;using System.Text;/* 属性 * 惯用法,属性开头字母大写,字段开头字母小写 * 只用set或者只有get就可以定义只读或者只写属性(只写的不常见) * 可以为set get设置访问经别 * (.Net3.x)简化set get; public int Age{ get; set; } 适合于set, get 中凤有特殊死搏斗逻辑代码的情况 * * 字段和属性的区别是什么?属性看似字段,不是字段,可以地非法值控制,可以设置只读 * set get块. 阅读全文
posted @ 2012-02-23 22:48 简单--生活 阅读(223) 评论(0) 推荐(0) 编辑
摘要: using System;using System.Collections.Generic;using System.Linq;using System.Text;/* 成员访问级别 * 字段,方法,属性都可以叫做类的成员,它们都需要定义访问级别,访问级别的用处在于控制成员在哪些些地方可以被访问,这样达到面向对像中"封装"的目的 * * 几个访问级别: public(任何地访都可以访问) private:默认级别,只能由本类中的成员访问 * 还有intemal, protected两个级别,以后会讲 */namespace _2面向对像简介{ class Program { 阅读全文
posted @ 2012-02-23 22:31 简单--生活 阅读(169) 评论(0) 推荐(0) 编辑
摘要: using System;using System.Collections.Generic;using System.Linq;using System.Text;/* 面向对像概念(*) * 面向对像不是取代面向过程的 * 类,对象。"人"是类,"张三"是"人"这个类的对像,类是抽像的,对象是的,按钮就是类,某个按钮就是对像,对像可以叫做类的实例 * 类就像int, 对像就像10,字段(和类相关的变量),字段就是类的状态,人这个是类的姓名,年龄,身高等字段,类不占内存,对像才占内存 * * 方法,方法就是类能够够执行的动作,比如间好 阅读全文
posted @ 2012-02-23 22:19 简单--生活 阅读(328) 评论(0) 推荐(0) 编辑
简单--生活(CSDN)