摘要
多态性是面向对象程序设计的重要特性之一,虚函数是实现多态性的基础。首先阐述了C++的多态性和联编技术,接着分析了C++的两种多态性:编译时的多态性和运行时的多态性,通过函数重载和虚函数对其进行了探讨,最后通过具体实例分析了实现动态联编的条件,指出虚函数是实现动态联编的关键。
Polyanorphism is one of the significant features of the object - oriented programming. Virtual function is the basis of realizing polymorphism . Firstly this article expounds polymorphism and binding technology in C ++ language, then analyses its two kinds of polymorphism: polymorphism in compiling and polymorphism in nmning . It argues them through function overloading and virtual function. Finally it analyses the conditions of realizing dynamic binding through some concrete instances and points out that virtual function is the crucial technology of realizing dynamic binding.
出处
《信息技术》
2006年第11期102-103,106,共3页
Information Technology
关键词
多态性
静态联编
动态联编
虚函数
polymorphism
static binding
dynamic binding
virtual function