}
else if (p-›n == 1)
delete p-›s;
p-›s = new char[strlen(s)+1];
strcpy(p-›s, s);
p-›n = 1;
return *this;
}
string& string::operator=(string& x)
{
x.p-›n++;
if (--p-›n == 0) {
delete p-›s;
delete p;
}
p = x.p;
return *this;
}
ostream& operator‹‹(ostream& s, string& x)
{
return s ‹‹ x.p-›s ‹‹ " [" ‹‹ x.p-›n ‹‹ "]\n";
}
istream& operator››(istream& s, string& x)
{
char buf[256];
s››buf;
x = buf;
cout ‹‹ "echo: " ‹‹ x ‹‹ "\n";
return s;
}