Fork me on GitHub
摘要: 抽象类使用abstract 修饰符对抽象类的使用有以下几点规定􀁺 抽象类只能作为其它类的基类它不能直接被实例化而且对抽象类不能使用new 操作符抽象类如果含有抽象的变量或值则它们要么是null 类型要么包含了对非抽象类的实例的引用􀁺 抽象类允许包含抽象成员虽然这不是必须的􀁺 抽象类不能同时又是... 阅读全文
posted @ 2014-12-17 16:38 乔闻 阅读(132) 评论(0) 推荐(0) 编辑
摘要: override是指“覆盖”,是指子类覆盖了父类的方法。子类的对象无法再访问父类中的该方法。(签名必须相同)new是指“隐藏”,是指子类隐藏了父类的方法,当然,通过一定的转换,可以在子类的对象中访问父类的方法。以下代码的运行结果是什么?[csharp] view plaincopyprint?cla... 阅读全文
posted @ 2014-12-17 15:52 乔闻 阅读(232) 评论(0) 推荐(0) 编辑
摘要: using System;class Vehicle//定义汽车类{public int wheels; //公有成员轮子个数protected float weight; //保护成员重量public Vehicle(){;};public Vehicle(int w,float g){wheel... 阅读全文
posted @ 2014-12-17 14:07 乔闻 阅读(158) 评论(0) 推荐(0) 编辑
摘要: using System;class Vehicle //定义汽车类{int wheels; //公有成员轮子个数protected float weight; //保护成员重量public Vehicle(){;}public Vehicle(int w,float g){wheels = w;w... 阅读全文
posted @ 2014-12-17 11:17 乔闻 阅读(100) 评论(0) 推荐(0) 编辑