文件名称:head
-
所属分类:
- 标签属性:
- 上传时间:2013-05-10
-
文件大小:1021byte
-
已下载:0次
-
提 供 者:
-
相关连接:无下载说明:别用迅雷下载,失败请重下,重下不扣分!
介绍说明--下载内容来自于网络,使用问题请自行百度
初学者对于多态的概念总是理解不清楚,一下通过几个实例在理解多态。
多态描述的是使用基类的指针或引用操作多个类型的能力。
我们知道,子类的指针是可以隐式转化为父类的,所以我们在进行程序设计的时候如果要对一个未知的类型进行处理,可以在方法声明时把参数的类型声明为父类的指针。
这要我们就是实现了根据传入的类型执行不同的方法。这里的关键是子类在重写父类的虚方法时是在虚方法表的相应位置对父类虚方法实现覆盖。-The beginners always understand the concept of polymorphism clear, through several examples in understanding polymorphic. The polymorphism described is to use a base class pointer or reference to the ability to operate more than one type of. We know that subclass pointer can be implicitly transformed the parent class, so during our programming if you want an unknown type processing method declaration type of the parameter declared as the parent class pointer . This is to achieve a to perform different method according to the incoming type. The key here is to subclass override the parent class' s virtual method in the corresponding position of the virtual method table cover virtual methods of the parent class.
多态描述的是使用基类的指针或引用操作多个类型的能力。
我们知道,子类的指针是可以隐式转化为父类的,所以我们在进行程序设计的时候如果要对一个未知的类型进行处理,可以在方法声明时把参数的类型声明为父类的指针。
这要我们就是实现了根据传入的类型执行不同的方法。这里的关键是子类在重写父类的虚方法时是在虚方法表的相应位置对父类虚方法实现覆盖。-The beginners always understand the concept of polymorphism clear, through several examples in understanding polymorphic. The polymorphism described is to use a base class pointer or reference to the ability to operate more than one type of. We know that subclass pointer can be implicitly transformed the parent class, so during our programming if you want an unknown type processing method declaration type of the parameter declared as the parent class pointer . This is to achieve a to perform different method according to the incoming type. The key here is to subclass override the parent class' s virtual method in the corresponding position of the virtual method table cover virtual methods of the parent class.
(系统自动生成,下载前可以参看下载内容)
下载文件列表
head.txt
本网站为编程资源及源代码搜集、介绍的搜索网站,版权归原作者所有! 粤ICP备11031372号
1999-2046 搜珍网 All Rights Reserved.