Chapter 2. Object Lifetime
The Object Life Cycle
There are four phases in the life of every C++ object: nonexistence, partially constructed, instantiated, and partially destroyed [Stro1997]. Furthermore, the space that an object occupies must be acquired prior to its construction, and released after its destruction.
Objects can be brought into existence in four standard ways:
Global (global, namespace, and class-static) objects exist outside the scope of any functions. They are (usually) created prior to the execution of
main(), and are automatically destroyed after it (section 11.1). The memory that they occupy is allocated by the compiler/linker.
Stack objects exist in a local execution frame, within a function. They are created at their point ...