摘要: static void Main(string[] args) { //冒泡法 int[] myArray = new int[10] { 0,2,1, 8, 3, 5, 6, 7, 4, 9 }; int temp = 0; for (int i = 1; i < myArray.Length; i++) { for (int j = 0; j < myArray.Length - i; j++) { // 如果 myArray[i] > myArray[i+1] ,则 myArray[i] 上浮一位 if (myArray[j] > myArray[j + 1]) 阅读全文
posted @ 2011-09-30 11:40 Curitis 阅读(304) 评论(2) 推荐(0) 编辑
摘要: 继承在应用程序开发过程中,需要完成功能相近但是实现不同的类来抽象对象的时候,就需要用到继承。继承优点 提高重用性:派生提高了代码的重用性,不至于在创建一个新对象时再重新写一个新的类。提高结构性:派生让程序有了结构,在程序开发过程,每一个派生类均继承上一个类的方法,且每个派生类除了可以使用公共的字段以外,可以专门为派生类增加字段和方法而不去影响到其他的派生类public class Animal //创建基类{public string type; //创建基类成员public string color; //创建基类成员public string sound; //创建基类成员}public 阅读全文
posted @ 2011-09-30 11:30 Curitis 阅读(220) 评论(0) 推荐(0) 编辑