cly

博客园 首页 新随笔 联系 订阅 管理

String& String::operator=(const string& other)
{
 if(this == &other)
 {
  return *this;
 }
 delete m_data;
 m_data = new char[strlen(other.m_data)+1];
 strcpy(m_data,other.m_data);
 return *this;
}

posted on 2013-07-21 17:41  戒色  阅读(333)  评论(0编辑  收藏  举报