虚函数
- 名virtual function
-
因此介绍了在以C为目标语言的C++编译系统中,实现用于支持多态性的虚函数机制的方法。
This paper introduces the technology to implement virtual function mechanism in C + + compiler , whose target language is C.
-
举例来说,创建一个纯虚函数:virtualintpurevirtualop(intx)=0,请执行如下这些操作
For example , to create a pure virtual function such as virtual int purevirtualop ( int x ) = 0 , perform these steps
-
举例来说,要创建一个虚函数:inlineintinlineop(intx),请您执行下述步骤
For example , to create an inline function such as inline int inlineop ( int x ), perform these steps
-
采用了继承、重载、虚函数等技术实现了设计的简单性和可扩展性,采用了XML技术实现了灵活的存储管理,成功的实现了页面视图、XML存储和接收机代码之间的相互转换。
Technologies like inheritance , overload , virtual Functions are applied to achieve the simplicity and scalability of design , while the XML is used to attain the flexible storage management , which succeed in transformation among canvas , XML storage and code of set-top-box .
-
这就是为什么类名可以像一个模板参数那样使用,也正是由于这样的特性,ATL就有了第二件狡猾的设计,编译时虚函数调用。
The reason for having the class name as a template parameter is so ATL can do the second tricky thing , compile-time virtual function calls .
-
本文探讨了影响vptr和虚函数表长度的因素。
This article discusses the factors which influences the length of VPTR and virtual function table .
-
由于现在没有共享对象,于是shmclient1创建了它们,引用它们的数据成员,调用它们的虚函数,然后退出&将对象留在了内存中。
Because no shared objects are present , it creates them , references their data members , invokes their virtual functions , and quits & leaving the objects behind in memory .
-
客户端或服务器端最重要的部分是虚函数NotifyReceivedPackage,定义如下
The most important part of the client or server code is the virtual function NotifyReceivedPackage , as described below
-
因此,对于所有这种共享对象来说,所有进程中的Vee-Table和虚函数都应该具有相同的虚地址。
Hence , for all such shared objects , Vee-Table and virtual functions should have the same virtual addresses in all processes .
-
首先,Vee-Table指针用于访问虚函数,而对数据成员的访问直接使用编译时偏移量实现。
First , the Vee-Table pointer is used to access virtual functions , and data members are accessed directly using compile time offsets .
-
包含虚函数的类定义的对象有一个虚函数表和一个指向虚函数表的指针vptr。
The object defined by the class which includes virtual function has a virtual function table and a pointer VPTR which points to the virtual function table .
-
它通过一个vptr和vtable在运行时进行动态绑定,从而能够根据对象类型的不同调用不同的虚函数;
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 ;
-
C++中虚函数的应用
The Application of Virtual Function in C + + Programming Language
-
试谈C++的多态性和虚函数
Discussion on Polymorphism and Virtual Function in C + + Language
-
C++虚函数机制及其实现
Virtual function of C + + and it 's implementation
-
如果不是虚函数,编译器直接生成代码调用函数。
Otherwise , the compiler generates code to call the function directly .
-
虚函数是实现动态多态性的方法。
Virtual Function is the method to realize dynamic polymorphism .
-
虚函数简单地向标准输出写一行文本。
The virtual functions simply write a line of text to standard output .
-
什么是纯虚函数?
What is a pure virtual function ?
-
第二次,进程只是引用数据成员和虚函数。
The second time , the process simply references the data members and virtual functions .
-
本文讨论了有限阿贝尔群上的希尔伯特变换和张&哈特莱变换的性质。由于引入了群元素排序的概念和定义了函数的奇偶性,从而能够将函数划分出真函数与虚函数两种类别。
This paper discloses properties of the Hilbert and Zhang-Hartley Transforms in Finite Abe-lian Groups .
-
讨论和示例程序都只限于非静态数据成员和虚函数。
The discussion and the sample program are limited to non-static data members and virtual functions .
-
类包含或者继承一个或多个纯虚函数,这样的类就是抽象基类。
A class containing ( or inheriting ) one or more pure virtual functions is an abstract base class .
-
介绍了实现运行时的多态性几个重要因素&虚函数、基类和派生类。
In this article , the important factor of realization running polymorphism ( virtual functions , base class ; derived class ) .
-
继承层次关系的根类应该定义虚函数性质的析构函数,即使这个析构函数不做任何的事情。
The root class of an inheritance hierarchy should define a virtual destructor even if the destructor has no work to do .
-
虚函数的多态是通过父类指针指向派生类对象来实现的。
Because virtual functions are called only for objects of class types , you cannot declare global or static functions as virtual .
-
当虚函数通过引用或者指针调用时,编译器生成代码来决定在运行期调用哪个函数。
When a virtual function is called through a reference or pointer , the compiler generates code to decide at run time which function to call .
-
客户机进程获得指向三个共享对象的指针,建立对它们的数据成员的三个引用,并且依赖于命令行的输入调用三个虚函数。
The client process gets pointers to three shared objects , makes three references to their data members , and depending on the command-line input invokes three virtual functions .
-
由于多语言图形用户界面工具、事件处理回调、虚函数回调和多线程运用的不断增多,传统的基于数据分析的约简技术或工具已经不适用。
As the multi-language tools , event handling callback , virtual function callback and the increasing use of multi-thread , the traditional reduction technologies based on data analysis are not applicable .
-
如果构造函数或者析构函数调用虚函数,虚函数的版本取决于构造函数或者析构函数的类型。
If a virtual is called from inside a constructor or destructor , then the version that is run is the one defined for the type of the constructor or destructor itself .