Summary
Pointers and dynamic variables are two of the most valuable tools in the basic C++ toolkit. They are worth the effort it takes to understand them and use them well. We learned that C++ does not enforce any discipline regarding the creation or deletion of dynamic variables. Developers can document the ownership of dynamic variables to bring some order to this chaos. We learned that a powerful way to manage ownership of dynamic variables is through the use of smart pointers, which tie the dynamic variable to an ordinary variable that is destroyed in a well-defined place. C++ is a powerful programming language because it offers a spectrum of choices, from bare-bones unsafe programming to expensive, automated smart library classes.
In the next chapter, we're going to take a deeper dive into the class type and object-oriented programming.