摘要
多态性是面向对象技术的重要特性之一,C++语言支持静态多态性和动态多态性.静态多态性主要通过函数重载和运算符重载来实现,动态多态性主要通过虚函数和动态联编来实现.多态性使程序设计更加灵活、易维护和易扩展.介绍了动态多态性在C++语言中的实现机制,提出基于容器的动态多态性实现技术,结合VC++6.0中绘图软件开发实例,描述基于容器的绘图过程及动态多态性应用.
Polymorphism is one of the most important characteristics of object-oriented technology.C++ language supports static polymorphism and dynamic polymorphism.The static polymorphism is achieved mainly through function overload and operator overload,while the dynamic polymorphism is achieved mainly through virtual function and dynamic binding.The polymorphism makes program design flexibler and easier to maintenance and extend.By the development example of drawing software in visual C++6.0,the implement mechanism of the dynamic polymorphism in C++ language is introduced and the implement technology of the dynamic polymorphism based on container is put forward.The drawing procedure and the application of the dynamic polymorphism based on container are described.
出处
《西安石油大学学报(自然科学版)》
CAS
北大核心
2009年第5期86-88,92,共4页
Journal of Xi’an Shiyou University(Natural Science Edition)
关键词
动态多态性
动态联编
虚函数
容器
dynamic polymorphism
dynamic binding
virtual function
container