Caution: Construction Area

Now that we've disposed of the default constructor, let's take a look at the line in the string interface definition (Figure 7.1) that says string(char* p);.[7] This is the declaration for another constructor; unlike the default constructor we've examined, this one has an argument, char* p.[8]

[7] I know we've skipped the copy constructor, the assignment operator, and the destructor. Don't worry, we'll get to them later.

[8] There's nothing magical about the name p for a pointer. You could call it George if you wanted to, but it would just confuse people. The letter p is often used for pointers, especially by programmers who can't type, which unfortunately is fairly common.

As we saw in Chapter 6, the combination of the ...

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.