Question: C++ and ASM C++ object Model (Encapsulation Only) 1. Life Cycle Create an object on the stack. When is the constructor called? What about the
C++ object Model (Encapsulation Only)
1. Life Cycle Create an object on the stack. When is the constructor called? What about the destructor? 2. Memory Layout Inspecting the addresses of those class members, are they contiguous in memory when instantiated? Where are they located? Are those member variables and member functions far away from each? 3. This Pointer Inspecting the assembly of a member function, is there an additional parameter? What about a static function defined in class? 4. Memory Layout Create another object on the stack. Are these on-stack objects in a contiguous memory layout? 5. Life Cycle Create an object on the heap. When is the constructor called? The destructor? 6. Memory Layout Create another object on the heap. Are these on-heap objects in a contiguous memory layout? 7. Memory Layout Are there more than one copy of member functions after so many objects have been created? 8. Keywords If we change class to struct, does it make any differences in ASM? 9. You can explore more C++ features like inheritance and polymorphism, or more specif-ically, virtual functions and templates, but that is not required.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
