类,构造函数和析构函数,类的指针。
派生类的构造函数基类指针,我怎么指向基类的指针?
For a derived class with a constructor that takes a base class pointer, how do I refer to the base class pointer?
当你通过基类的指针来调用虚函数,技术也是一样的。
When you invoke calls through a pointer to the base class, the technique is the same.
在这种情况下,你不要父类的指针存储在变量p,但整个类本身。
In such case you don't store a pointer to the Parent class in variable p, but the whole class itself.
正常情况下会传递一个指向结构或类的指针,该结构或类包含了一些客户端的指定对象。
Normally, a pointer to a structure or a class that can contain some client specific objects is passed with this parameter.
通过运行时类型识别(RTTI),程序能够使用基类的指针或引用来检索这些指针或引用所指对象的实际派生类型。
Run-time Type Identification (RTTI) allows programs that use pointers or references to base classes to retrieve the actual derived types of the objects to which these pointers or references refer.
它在两个域中都放置一个空指针来表示空链表,而不是为空链表定义一个单独的类。
Instead of defining a separate class for empty lists, it represents empty lists by putting a null pointer in both fields.
例如,不像一个类转型异常,空指针异常不给出它所需要的内容的任何信息,只有一个空指针。
Unlike, for example, a class-cast exception, a null-pointer exception says nothing about what was expected instead of the null pointer.
DataObjectPtr实际上是包含指向数据对象的指针的包装类。
A DataObjectPtr is really a wrapper class holding a pointer to the DataObject.
通过调用 DL_Dxf对象的in函数并将指针传递给一个继承 DL_CreationAdapter抽象类来打开此文件。
You open the file by calling the in function of the DL_Dxf object and passing a pointer to a class that inherits from the DL_CreationAdapter abstract class.
与可怕的空指针异常(该异常除了报告空指针之外,对于将要发生的事情什么也不说)不同,类强制转换异常相对来说容易调试。
Unlike the dreaded null-pointer exception (which says nothing about what was expected to occur instead of the null pointer), a class-cast exception is relatively easy to debug.
相反,在运行时发出的错误将会是一个空指针异常而不是类强制转换异常。
Instead, the error signaled at run time would be a null-pointer exception instead of a class-cast exception.
即便我们可以采用不同的测量方式,例如代码行数、类的数量、函数指针的数量、系统漏洞的数量,等等,软件还是缺乏一种定义良好的原子结构。
Software also lacks a well defined atomic unit of work — even though we can apply various measures, such as lines-of-code, number of classes, number of function points, number of bugs, etc.
无论使用那种技术,定制化方案主要分为两类:基于指针的定制化和基于符号的定制化。
Irrespective of the precise technology involved, customization approaches break down into two main families: Pointer-based and token-based customization.
我见过的许多基于CSS的导航标签大都具有一类的特征:矩形的色块,也许仅仅是一个轮廓,对于当前选中的标签则没有边框,标签在鼠标指针游至其上时改变颜色。
Many of the CSS-based tabs I've seen suffer from the same generic features: blocky rectangles of color, maybe an outline, a border disappears for the current TAB, a color changes for the hover state.
这意味着它们可以作为这两个类和函数指针的行为,在同一时间。
This means that they can act as both classes and function Pointers at the same time.
未检查异常作为运行时exception类是理想的异常侯选处理不可恢复性出错,如资源不可用或者空指针。
Unchecked exceptions which are descendents of RuntimeException class are the ideal candidate exceptions handle non-recoverable errors such as resource non-availability or some null Pointers.
一种快速但不正确的解决这个问题的方法是除去Leaf类并通过简单地将空指针放在Branch的left和right字段中来表示leaf节点。
The quick but incorrect way to remedy the problem would be to eliminate the Leaf class and represent Leaf nodes simply by putting null Pointers in the left and right fields of a Branch.
本身支持64位类型的系统通常都采用一种称为“LP64”的模型,其中long类型和指针大小都是64位的。
Systems with native 64-bit types often went to a model called "LP64," where the long and pointer sizes were both 64 bit.
现在这一类型的值可以通过内建的函数new来分配,这将返回一个指针,指向一块内存单元,其所占内存槽初始化为零。
Values of this type can now be allocated using the built-in function new, which returns a pointer to the value in memory with all slots initialized to the zero value.
在这个方案中,对象由指针代表,而GtkWidget是GTK +层次结构中的基本类型——叫做类,其他类都从它派生而来。
In this scheme, objects are represented by Pointers, and GtkWidget is the basic type — called a class — in the GTK + hierarchy from which all other classes are derived.
这个类提供了删除指针容器的所有权属性的一种方法。
This class provides a way to remove ownership properties of the pointer containers.
对于类对象包含指针的情况下,我们要编写自己的拷贝构造函数,这样可以防止上述情况的发生。
For a situation where an object contain Pointers we have to write our own copy constructor that will prevent situations like those mentioned above.
当具有基类的引用或指针,但需要执行不是基类组成部分的派生类操作的时候,需要动态的强制类型转换。
Dynamic casts are needed when we have a reference or pointer to a base class but need to perform operations from the derived class that are not part of the base class.
如果基类成员与派生类成员接受的实参不同,就没有办法通过基类类型的引用或指针调用派生类函数。
If the base member took different arguments than the derived-class member, there would be no way to call the derived function from a reference or pointer to the base type.
有一个为每个类的虚表,其中包含每个成员的功能的实现的指针列表。
There's a virtual table for each class, which contains a list of Pointers to the implementation of each member function.
所以你的类将有两个构造器,一个有函数指针,另一个没有。
So, your class has two constructors, one with a function pointer and the other without it.
具有指针成员且使用默认合成复制构造函数的类具有普通指针的所有缺陷。
Classes that have pointer members and use default synthesized copy control have all the pitfalls of ordinary Pointers.
具有指针成员且使用默认合成复制构造函数的类具有普通指针的所有缺陷。
Classes that have pointer members and use default synthesized copy control have all the pitfalls of ordinary Pointers.
应用推荐