O'Reilly logo

C++ Without Fear: A Beginner’s Guide That Makes You Feel Smart by Brian Overland

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

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 ...

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