码迷,mamicode.com
首页 > Windows程序 > 详细

c# 第四课 类的更多内容

时间:2015-04-07 13:27:36      阅读:190      评论:0      收藏:0      [点我收藏+]

标签:

与类密切相关的几个特征便是继承,多态和封装了,继承

inheritance
ØThe specialization relationship is typically implemented using inheritance.
Polymorphism(多态):  There are two powerful aspects to inheritance.
ØOne is code reuse.
ØThe second is polymorphism(many-forms).
在父类中定义的虚函数,可以在子类中被重写。override是必要的。
Limitations of Abstract
ØAbstract does force all the derived classes to implement the method, but nothing forces the derived derived classes to implement its own DrawWindow() method.
ØSealed 类(完全不允许派生), 防止偶然继承。与Abstract类(用来派生)正相反。
ØSealed class 中不能创建新的Protected成员。

c# 第四课 类的更多内容

标签:

原文地址:http://www.cnblogs.com/GSONG/p/4397989.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!