Listing 4 String class with a copy constructor and assignment operator

// str2.h

#include <stddef.h>

class ostream;
class istream;

class string {
public:
    // Add these:
    string(const string&);
    string& operator=(const string&);

    // The rest as in Listing 1
};

// Add this:
inline string::string(const string& s2)
{
    clone(s2.data);
}

// The rest as in Listing 1

/* End of File */