To tylko jedna z 3 stron tej notatki. Zaloguj się aby zobaczyć ten dokument.
Zobacz
całą notatkę
Order of calling constructors and Destructors Constructors 1. base class (classes in order of declaration) 2. class members in order of declaration 3. constructor's body Destructors - simply opposite order 1. destructor's body 2. destructors of class members (order opposite to declaration) 3. destructor of the base class (classes in order opposite to declaration) objects defined in blocks (local, automatic) - constructors are called when the definition is executed - destructors after leaving the block, order opposite to constructors global objects (static) - constructors are called in an order of objects' definitions, before calling the main() function - destructors in order opposite to constructors, after leaving main(). dynamic objects are controlled by the programmer (new and delete) memory allocation and a constructor call: when the operator new is executed destructor and deallocation: delete
... zobacz całą notatkę
Komentarze użytkowników (0)