Assume p is a private pointer member of class DeepClass that gets assigned dynam
ID: 3852480 • Letter: A
Question
Assume p is a private pointer member of class DeepClass that gets assigned dynamically allocated data in one or more of DeepClass's instance methods. p controls this dynamically allocated memory. Check all that apply.
A. A non-destructor instance method of DeepClass may not deallocate the memory that p controls. B. The memory that p controls will be deallocated when a DeepClass object goes out of scope if an appropriately written user-defined destructor is provided for DeepClass. C. The memory that p controls will be deallocated when a DeepClass object goes out of scope automatically by C++'s default destructor. D. Memory that p controls must be allocated at object construction. E. A user-defined destructor of DeepClass can deallocate the memory that p controls.Explanation / Answer
Answer:
C. The memory that p controls will be deallocated when a DeepClass object goes out of scope automatically by C++'s default destructor.
D. Memory that p controls must be allocated at object construction.
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.