Challenge 1: Observing Constructor and Destructor Order — Possible Solution ==================================================================== #include class IntArray { private: int *data; public: IntArray(int size) { data = new int[size]; std::cout << "IntArray constructed" << std::endl; } ~IntArray() { delete[] data; std::cout << "IntArray destroyed" << std::endl; } }; int main() { std::cout << "Before inner scope" << std::endl; { IntArray arr(10); std::cout << "Inside inner scope" << std::endl; } std::cout << "After inner scope" << std::endl; return 0; } Output: Before inner scope IntArray constructed Inside inner scope IntArray destroyed After inner scope WHY THIS WORKS AS AN ANSWER ------------------------------ The constructor message prints the moment arr is declared (new[] allocates, the constructor body runs immediately after), and the destructor message prints exactly at the closing brace of the inner scope -- not at the end of main -- confirming the resource is released automatically the instant the object's lifetime ends, exactly the RAII mechanism the chapter describes.