However, if you want exception handling you must do it only in the TearDown code because throwing an exception from the destructor results in undefined behavior. 但是,如果需要异常处理,那么只能在TearDown代码中进行,因为从析构函数中抛出异常会导致不确定的结果。
Hence, ANSI C++ does not recommend throwing exceptions in the constructor and destructor of a class whose instances may be defined globally ( static-globally). 因此,ANSIC++不建议在那些其实例可能被定义为全局实例(静态全局实例)的类的构造函数和析构函数中抛出异常。
The constructor and destructor methods of this object do the necessary setup and cleanup. 这个对象的constructor和destructor方法执行必需的设置和清除工作。
The other way to say it is, never define a global ( static global) instance of a class whose constructor or destructor may throw exceptions. 换一种说法就是永远都不要为那些其构造函数和析构函数可能抛出异常的类定义全局(静态全局)实例。
This destructor would have to be called specifically before unsetting the parent class reference. 这种解构器必须在解除父类引用之前进行调用。
Modeling constructor, destructor, and copy constructor 建模构造函数、分析构造函数,以及拷贝构造函数
The gcc developers thought of this, too, and provided the means for a main function constructor and destructor that happen to fit this need perfectly. gcc的开发者也考虑过这个问题,它们为main函数的constructor函数和destructor函数提供了一些碰巧能够满足这个要求一些方法。
Note that I provide three functions: a constructor, a destructor, and a status function that emits information about the character represented by the object instance. 注意我提供了3个函数:构造器、销毁器和状态函数(状态函数发出对象实例所代表的角色的信息)。
A return type should not be set for a UML operation representing either a constructor or a destructor. 不应该为表示构造方法或析构方法的UML操作设置返回类型。
To create your constructor and destructor, declare two functions, then apply the constructor and destructor function attributes to them. 要创建constructor和destructor函数,则需要声明两个函数,然后对这两个函数应用constructor和destructor函数属性。
A destructor is named in a similar manner, except that it has a~ ( tilde) followed by the parent's name. 析构方法按类似的方式命名,除了它的母体名前有一个~(否定号)。
Java code automatically manages memory, whereas C++ doesn't, so the Java language doesn't require destructor methods. Java代码自动管理内存,但是C++却不是如此,因此Java语言不需要解除器方法。
Allows defining a destructor function that runs when an object is destroyed. 允许定义一个析构函数当对象崩溃的时候运行。
When the handle scope's destructor is called all handles created within that scope are removed from the stack. 当句柄范围的析构函数被调用时,所有在那个范围中创建的句柄都将被从栈中移除。
This is mostly a problem with objects that implement a destructor to free non-memory resources. 对于实现了析构函数释放非内存资源的对象来说,这是最常见的问题。
The programmer has no control over when the destructor is called because this is determined by the garbage collector. 程序员无法控制何时调用析构函数,因为这是由垃圾回收器决定的。
This may cause the reference count for the object previously bound to the name to reach zero, causing the object to be deallocated and its destructor ( if it has one) to be called. 这可能导致早先约束到该名字的对象的引用计数降为零,导致释放该对象的分配空间并调用其析构器,如果它有一个的话。
Because it does not have a destructor. 因为它没有一个析构函数。
A destructor, in general, can perform any operation that the class designer wishes to have executed subsequent to the last use of an object of that class. 析构函数可以执行类设计者希望执行的任何操作,这些操作和类对象使用完毕之后执行。
Constructor/ Destructor allowed in class/ struct only an upright in house framing. 仅在类/结构中允许构造函数/析构函数房屋构造中的一种柱子。
If a class defines a copy constructor, acopy assignment operator, or a destructor, then it should define all three. 如果一个类定义了拷贝构造函数、赋值操作符、析构函数中的一个,那么通常需要全部定义这仨函数。
Constructor/ Destructor must not return any value 构造函数/析构函数不可返回任何值
Local handles are held on a stack and are deleted when the appropriate destructor is called. 本地句柄。本地句柄在栈上,并且当指定的析构函数被调用时删除。
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. 如果构造函数或者析构函数调用虚函数,虚函数的版本取决于构造函数或者析构函数的类型。
Understand and master the constructor, destructor, copy constructor, default constructor and default constructor parameters, to define methods and objects of the structure and the role of withdrawal. 理解并掌握构造函数、析构函数、拷贝构造函数、默认构造函数和缺省参数的构造函数的含义、定义方法以及在对象的构造和撤消中的作用。
Attribute cannot be used on a class that has constructor and/ or destructor 属性不能在具有构造函数和/或析构函数的类上使用
The function of using VC6 Debug trace constructor, destructor and member functions are executed. 用VC6的Debug的功能跟踪构造函数、析构函数和成员函数的执行顺序。
So, different from the first example, we need to implement a destructor. 因此,从第一个例子不同,我们需要实现一个析构函数。
It is possible for the destructor to throw an exception. 这是可能的析构函数抛出一个异常。
We also need to add a destructor to the class. 我们还需要添加一个析构函数的类。