C++中虚函数的实现机制  被引量:6

Implementation mechanism of virtual functions in C++ programming language

在线阅读下载全文

作  者:夏承遗[1] 董玉涛[1] 赵德新[1] 唐树刚[1] 陈国章[1] 张桦[1] 

机构地区:[1]天津理工学院计算机科学与工程系,天津300191

出  处:《天津理工学院学报》2004年第3期65-67,共3页Journal of Tianjin Institute of Technology

基  金:天津市自然科学基金资助项目(033600211)

摘  要:介绍了C++编程语言中的虚函数及其在进行面向对象程序设计中重要性,并且详细阐述了它在编译器底层虚函数的实现机制.它通过一个vptr和vtable在运行时进行动态绑定,从而能够根据对象类型的不同调用不同的虚函数;并通过实例测试验证了上述机制.The virtual function in C+G-+ and its importance are introduced in this article, and the implementation mechanism of the virtual function is expounded in detail. It is dynamically bound through a virtual pointer(vptr) and virtual table during the running time, and so different class virtual function are called by the object′s type; and this mechanism is verified through a testing program.

关 键 词:C++ 虚函数 实现机制 面向对象程序设计 

分 类 号:TP312[自动化与计算机技术—计算机软件与理论]

 

参考文献:

正在载入数据...

 

二级参考文献:

正在载入数据...

 

耦合文献:

正在载入数据...

 

引证文献:

正在载入数据...

 

二级引证文献:

正在载入数据...

 

同被引文献:

正在载入数据...

 

相关期刊文献:

正在载入数据...

相关的主题
相关的作者对象
相关的机构对象