Some of the previous videos and reading have covered the implications of an object owning some dynamically allocated memory. Mainly, what I’m referring to here is the need for a copy constructor, overloaded assignment operator, and destructor in a class that contains any dynamically allocated memory. That’s all important stuff. Know it, learn it, love it.
But what about the dynamic allocation of objects themselves – how does it work and what are the implications. I’m glad you asked. Dynamically allocating an object is just like dynamically allocating anything else. [Read more…]