Second Review

After finishing up the requirements to make the string class a concrete data type, we continued to add more facilities to the string class; to be precise, we wanted to make it possible to modify the sorting program of Chapter 4 to handle strings rather than shorts. To do this, we had to be able to compare two strings to determine which of the two would come first in the dictionary and to read strings from an input stream (like cin) and write them to an output stream (like cout). Although the Display function provided a primitive mechanism for writing a string to cout, it's much nicer to be able to use the standard >> and << operators that can handle all of the native types, so we resolved to make those available for strings as ...

Get Learning to Program in C++ 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.