O'Reilly logo

SAMS Teach Yourself C++ in 10 Minutes SECOND EDITION by Jesse Liberty

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Who Allocates, Who Deletes, Who Uses, What's Shared

The ownership of objects is one of the most important concerns in object-oriented programming. In the case of theAccumulator, theExternalInterface, and theTape passed to aController, the instances are owned by the part of the program that defined the instance of aController (in this case, main()). aController is not empowered to get rid of these objects, because it only has references to them. However, the compiler does not enforce this policy, so you must.

Other classes, such as aRequest and anAccumulator, retain complete ownership over their member variable storage, which is created and destroyed along with the instance.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required