A constructor assembles the execution environment for the member
functions for a class from the bottom up (members first). The
destructor disassembles it from the top down (members last).[from C++ programming language]
please can someone describe this? I understand that members functions means here members functions of the class, but what "members" first? is this related to function on the stack? what means "assembles the execution environment"?
The sentence is quite abstract. The execution environment of a a member function are the members of the class itself and members exposed by one of the base-classes.
Presumably, what is meant by “assemble the execution environment”, is to initialize all members and bases of the class (note that member functions don’t need to be initialized).
I don’t see how this would relate to an object being on the stack or not.
An example:
Please note that you don’t need to write out the destructor in the
above case. This is just done for exemplary purposes here.