摘要: using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace ConsoleApplication1{ // 访问限制. #region 自定义类 class MyClass { private void ShowMessage() // 私有方法, 关键字 Private . 这是也是默认的. { Console.WriteLine("私有的,不能在类的外部被访问"); } public void SH... 阅读全文
posted @ 2012-09-28 15:09 梦断难寻 阅读(645) 评论(0) 推荐(0) 编辑
摘要: 1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Text; 5 6 namespace ConsoleApplication1 7 { 8 //定义类 9 class Look10 {11 public static int Dev(int x, int y)12 { return x / y; }13 public static double Dev(double x, double y) ... 阅读全文
posted @ 2012-09-09 21:46 梦断难寻 阅读(648) 评论(0) 推荐(0) 编辑
摘要: 1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Text; 5 6 namespace ConsoleApplication1 7 { 8 // 在此处定义一个类. 9 class shuxue10 {11 // 静态成员只能通过类本身使用12 public const double PI = 3.14; //常量是一个隐士静态成员.13 public int Add(int x, int ... 阅读全文
posted @ 2012-09-09 20:44 梦断难寻 阅读(557) 评论(0) 推荐(0) 编辑
摘要: using System;using System.Collections.Generic;using System.Linq;using System.Text;// 类文件namespace RenClass{ class Ren { private string name; private uint age; private string gender; public string Name { set { if (name != ... 阅读全文
posted @ 2012-09-08 20:14 梦断难寻 阅读(712) 评论(1) 推荐(0) 编辑
摘要: using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace RenClass{ class Ren { private string name; private uint age; private bool gender; #region 不带参数的构造方法 public Ren() //构造方法. C#默认是有公共构造器的, 如果不自己定义构造器那么C#就调用公共构造器. 自己定义... 阅读全文
posted @ 2012-09-07 23:40 梦断难寻 阅读(1096) 评论(0) 推荐(0) 编辑
摘要: // 前言:// 今天我们在另外一个.cs文件里面定义类,顺便学习一下引用命名空间. // 操作步骤 :// 在菜单依次执行下列步骤. // 1. 项目 2. 添加类. 3.选择类 4. 为你的类起一个名字 5.确定 1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Text; 5 6 // 这个就是我们的类文件了. Ren.cs 7 namespace RenClass 8 { 9 cl... 阅读全文
posted @ 2012-09-05 22:02 梦断难寻 阅读(18772) 评论(0) 推荐(0) 编辑
摘要: 1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Text; 5 6 namespace ConsoleApplication1 7 { 8 class Program 9 {10 // 要理解递归,先要理解递归. (这只是一句玩笑话 )11 // 递归,顾名思义就是递来归去,如此反复,直到不符合某个条件. 而函数递归意思也就是函数调用函数自己. 下面用代码来示例:12 13 static in... 阅读全文
posted @ 2012-09-05 20:44 梦断难寻 阅读(5078) 评论(0) 推荐(0) 编辑
摘要: 1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Text; 5 6 namespace ConsoleApplication1 7 { 8 class Program 9 { 10 /* 先来了解一下什么是实参, 什么是形参. 11 所谓形参其实也就是说函数定义的时候所带的参数. 比如 static void Myfuntion(int i , int t) 其中 int ... 阅读全文
posted @ 2012-09-04 21:58 梦断难寻 阅读(7685) 评论(0) 推荐(0) 编辑
摘要: 1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Text; 5 6 namespace ConsoleApplication1 7 { 8 class Program 9 {10 // 函数的定义方法11 // 修饰符 返回值 函数名 (参数)12 // 定义函数. ↓13 static void MyFuntion1(int i, int t) //一个无返回值的函数, (Vo... 阅读全文
posted @ 2012-09-04 21:18 梦断难寻 阅读(16946) 评论(0) 推荐(0) 编辑
摘要: 1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Text; 5 6 namespace ConsoleApplication1 7 { 8 class Program 9 {10 static void Main(string[] args) ... 阅读全文
posted @ 2012-09-02 22:39 梦断难寻 阅读(47307) 评论(2) 推荐(0) 编辑