文件名称:head
介绍说明--下载内容均来自于网络,请自行研究使用
初学者对于多态的概念总是理解不清楚,一下通过几个实例在理解多态。
多态描述的是使用基类的指针或引用操作多个类型的能力。
我们知道,子类的指针是可以隐式转化为父类的,所以我们在进行程序设计的时候如果要对一个未知的类型进行处理,可以在方法声明时把参数的类型声明为父类的指针。
这要我们就是实现了根据传入的类型执行不同的方法。这里的关键是子类在重写父类的虚方法时是在虚方法表的相应位置对父类虚方法实现覆盖。-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