摘要
基于对C + +语言多态性的研究 ,把多态性定义为同一个消息被不同类型的对象或相同类型的对象接收后产生不同的行为。根据各种多态性的特征 ,多态性可分为参数多态性、包含多态性、重载多态性、强制多态性和宏多态 ;多态从实现的角度来讲可以划分为两类 ,即编译时的多态和运行时的多态。重点阐述了面向对象的早期联编和滞后联编及运行时的多态性。
Based on the study of C++ polymorphism, the author of this paper defines that the polymorphism means different type or same type of objects may behave quite differently when they receive the same message. According to the characteristics of all kinds of polymorphism, it can be divided into parameterized polymorphism, inclusion polymorphism, overload polymorphism, enforced polymorphism and macro polymorphism. From the angle of its realization, the polymorphism can be divided into two kinds: static polymorphism and dynamic polymorphism. The author emphasizes the object-orientation of early binding, late binding and the polymorphism in operation.
关键词
C++语言
多态性
虚函数
滞后联编
泛型编程
C++ language
polymorphism
virtual function
late binding
generic programming