As you get deeply into the fine art of writing classes, you’ll sooner or later have to confront issues related to resource management.
To be more specific: when certain kinds of objects come into existence, the program code must ask the system to allocate some resource. The most common kind of resource is memory. As you’ll see in this chapter, resource management creates some special problems that, fortunately, C++ has specific language features to handle.
This chapter shows how to write a high-level String class, which gives a simple but thorough demonstration of resource-management issues.
The purpose of this class, like most classes, is to hide details. The String class frees users of the class from the ...