|Access||Adobe photoshop||Algoritmi||Autocad||Baze de date||C||C sharp|
|Calculatoare||Corel draw||Dot net||Excel||Fox pro||Frontpage||Hardware|
|Php||Power point||Retele calculatoare||Sql||Tutorials||Webdesign||Windows|
A destructor is a member that implements the actions required to destruct an instance of a class. A destructors is declared using a destructor-declaration:
attributesopt ~ identifier ( ) block
A destructor-declaration may include a set of attributes (17).
The identifier of a destructor-declarator must name the class in which the destructor is declared. If any other name is specified, an error occurs.
The block of a destructor declaration specifies the statements to be executed in order to destruct an instance of the class. This corresponds exactly to the block of an instance method with a void return type (10.5.8).
Destructors are not inherited. Thus, a class has no destructors other than the one which may be declared in it.
Since a destructor is required to have no parameters, it cannot be overloaded. Thus, a class can have, at most, one destructor.
Destructors are invoked automatically, and cannot be invoked explicitly. An instance becomes eligible for destruction when it is no longer possible for any code to use the instance. Execution of the destructor for the instance may occur at any time after the instance becomes eligible for destruction. When an instance is destructed, the destructors in its inheritance chain are called, in order, from most derived to least derived.
The output of the example
since destructors in an inheritance chain are called in order, from most derived to least derived.
Politica de confidentialitate | Termeni si conditii de utilizare|