15 What’s “this”: The String Class
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 ...
Get C++ Without Fear: A Beginner’s Guide That Makes You Feel Smart now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.