xxxxxxxxxx
Example5& operator= (const Example5& x) {
*ptr = x.content();
return *this;
}
xxxxxxxxxx
Example5& operator= (const Example5& x) {
delete ptr; // delete currently pointed string
ptr = new string (x.content()); // allocate space for new string, and copy
return *this;
}