管理构造函数和析构函数中的异常
应该忽略析构函数中的异常吗?
栈展开期间会经常执行析构函数。
程序退出时也会调用析构函数。
因为它没有一个析构函数。
是一个析构函数当对象超出作用域称为?
类,构造函数和析构函数,类的指针。
另外析构函数也不仅仅是用来释放资源。
A destructor is not limited only to relinquishing resources.
无法继承或重载析构函数。
只能对类使用析构函数。
不应使用空析构函数。
如果存在析构函数,则将其重写为类终结器。
If a destructor is present, rewrite that to be the class finalizer.
允许定义一个析构函数当对像崩溃的时候运行。
Allows defining a destructor function that runs when an object is destroyed.
调用析构函数时,将调用垃圾回收器来处理该队列。
When the destructor is called, the garbage collector is invoked to process the queue.
队列类的构造函数和析构函数负责创建和销毁互斥锁,见清单1。
The constructor and destructor of the queue class are responsible for the creation and destruction of the mutex, as shown in Listing 1.
对于实现了析构函数释放非内存资源的对象来说,这是最常见的问题。
This is mostly a problem with objects that implement a destructor to free non-memory resources.
与析构函数不同,构造函数内部所做的事情经常会抛出异常。
Unlike destructors, it is often the case that something done inside a constructor might throw an exception.
没有注意到的是,对象的析构函数调用后会引起很大的麻烦。
No pay attention to this, the situation in which only the object destructor is called can make great deal of troubles.
尽管调用了析构函数,但是未调用数组中各个对象的构造函数。
The constructors for the individual objects in the array are not invoked, although the destructors are.
结构不能声明默认构造函数(没有参数的构造函数)或析构函数。
A struct may not declare a default constructor (a constructor without parameters) or a destructor.
程序员无法控制何时调用析构函数,因为这是由垃圾回收器决定的。
The programmer has no control over when the destructor is called because this is determined by the garbage collector.
接口不能包含常量、字段、运算符、实例构造函数、析构函数或类型。
An interface cannot contain constants, fields, operators, instance constructors, destructors, or types.
当句柄范围的析构函数被调用时,所有在那个范围中创建的句柄都将被从栈中移除。
When the handle scope's destructor is called all handles created within that scope are removed from the stack.
我假设他们将简单地调用基类析构函数,然后释放内存(对于整个派生类)。
I would assume they would simply call the base-class destructor, then deallocate the memory (for the entire derived class).
“客户端块”是由MF c程序用于需要析构函数的对象的特殊类型内存块。
A client block is a special type of memory block used by MFC programs for objects that require a destructor.
放在单独的功能调用析构函数和拷贝构造函数和赋值运算符你所需要的功能。
Put the functionality you need in separate functions called by the destructor and the copy constructor and the assignment operator.
放在单独的功能调用析构函数和拷贝构造函数和赋值运算符你所需要的功能。
Put the functionality you need in separate functions called by the destructor and the copy constructor and the assignment operator.
应用推荐