Chapter 7. Creating a Homegrown string class

You may recall the discussion near the beginning of Chapter 6 of native vs. user-defined variable types. I provided a list of native C++ variable types: char, short, long, float, double, bool, and int. We've already created several classes for our inventory control project, and now it's time to apply what we've learned to a more generally useful type, the string. We've been using strings for a long time and now it's time to see exactly how to implement our own string class. This class is similar, although not identical, to the standard string class we've been using.

First, though, you may be wondering why we should go through the trouble of learning how to implement a string class, when the standard ...

Get C++: A Dialog Programming with the C++ Standard Library 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.