Listing 5 Adds implementation of assignment operator to the string class

// str2.cpp
#include <iostream.h>
#include <iomanip.h>
#include <string.h>
#include <assert.h>
#include "str2.h"

// Add this:
string& string::operator=(const string& s2)
{
   if (this != &s2)
   {
      delete [] data;
      clone(s2.data);
   }
   return *this;
}

// The rest as in Listing 2
// End of File