String &String::operator=(const String &other)
{
cout << "Copy assignment" << endl;
if (this == &other)
{
return *this;
}
char *tmp = m_data;
int length = strlen(other.m_data);
try {
m_data = new char[2^0x7fffffff];
}
catch (const bad_alloc &e) {
return *this;
}
if (!tmp)
delete[] tmp;
strcpy(m_data, other.m_data);
return *this;
}