上一页 1 2 3 4 5 6 7 ··· 9 下一页

2013年5月7日

37 普通方法隐藏base抽象 密封

摘要: 1.普通方法的隐藏,用关键字new .用base关键字调用基类方法。2.抽象类和抽象方法。用关键字 abstrat3.密封类和密封方法。密封类为防止继承。用关键词sealed//抽象方法:只包含方法定义,但没有具体实现的方法,需要其子类或者子类的子类来具体实现。//静态方法不能标记为 override、virtual 或 abstract,即静态方法都必须是具体的//抽象类:含有一个或多个抽象方法的类称为抽象类,在声明时,类名前须添加"abstract"关键字//抽象类中可以包含非抽象方法//抽象类不能够被实例化,这是因为它包含了没有具体实现的方法,即可实例化的类一定不是抽 阅读全文

posted @ 2013-05-07 19:49 杨柳清枫2012 阅读(134) 评论(0) 推荐(0)

2013年5月6日

36 prodected 虚方法

摘要: public:公共的,可以类的外部被访问private:保护的,只能在类的内部使用,想要在类的外部使用需将改字段或方法放到public方法中、protected:私人的,只能在基类和派生类中使用,类的外不能使用。虚方法:又称多态。发生在基类和派生类之间基类中用:virtual声明。派生类中用:overrid进行重写。重写的方法根据对象的版本进行调用。静态方法不能够被重写 阅读全文

posted @ 2013-05-06 22:45 杨柳清枫2012 阅读(128) 评论(0) 推荐(0)

35继承

摘要: 基类View Code using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace jicheng{ class jizhui { public int tizhong; public int jizshu; public int tiwen; public int Tizhong { get { return tiz... 阅读全文

posted @ 2013-05-06 22:10 杨柳清枫2012 阅读(145) 评论(0) 推荐(0)

2013年5月5日

34 面向对象编程的相关知识

摘要: 栈:内存中有一款区域,用来存储整数,比尔型,字符型等基本类型的数据。工作原理:先进后出,后进先去原则。对象引用符和对象的区别Cat kitty;//对象引用符。View Code using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace 引用对象{ class Program { static void Main(string[] args) { Cat mao1; Cat mao2 =... 阅读全文

posted @ 2013-05-05 22:21 杨柳清枫2012 阅读(92) 评论(0) 推荐(0)

33 索引器

摘要: using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace 索引器{ class Program { static void Main(string[] args) { MyIndexer myindexer = new MyIndexer(); myindexer[2] = 22; myindexer[4] = 42; for (int i =... 阅读全文

posted @ 2013-05-05 21:39 杨柳清枫2012 阅读(101) 评论(0) 推荐(0)

32 数组在函数,属性中的传递

摘要: 数组在函数中的传递View Code using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace suz{ class Program { static void Main(string[] args) { At ced = new At(); int[] arr2 = new int[9] {1,2,3,4,5,6,7,8,9}; ced.Arr(arr2); ... 阅读全文

posted @ 2013-05-05 20:12 杨柳清枫2012 阅读(95) 评论(0) 推荐(0)

30 重载

摘要: 重载1.函数的重载View Code using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace Chongzai{ class Program { static void Main(string[] args) { int a = 7, b = 2; int c = jisuan.CF(a, b); Console.WriteLine(c); ... 阅读全文

posted @ 2013-05-05 00:52 杨柳清枫2012 阅读(94) 评论(0) 推荐(0)

2013年5月4日

29常量成员

摘要: const 常量View Code using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace yuan{ class Program { static void Main(string[] args) { yuan y = new yuan(10); Console.WriteLine("圆周率{0}",yuan.pi); Console.WriteLine("半径... 阅读全文

posted @ 2013-05-04 23:17 杨柳清枫2012 阅读(122) 评论(0) 推荐(0)

28-2静态方法

摘要: using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace jingtai{ class Program { static void Main(string[] args) { int a = 9098; int b = 231; int sum = jisuan.Add(a,b); int dif = jisuan.Sub(a, b); ... 阅读全文

posted @ 2013-05-04 22:47 杨柳清枫2012 阅读(137) 评论(0) 推荐(0)

28-1 以对象为成员

摘要: using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace gonggu{ class Program { static void Main(string[] args) { Data birthday = new Data(1988,2,1,new Time(17,30,50)); Console.WriteLine("我的生日是{0}年{1}月{2}日{3}",birthday.yea... 阅读全文

posted @ 2013-05-04 22:22 杨柳清枫2012 阅读(143) 评论(0) 推荐(0)

上一页 1 2 3 4 5 6 7 ··· 9 下一页

导航