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.

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.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!