class String { private: char* m_str; public: String(const char* str = NULL) { m_str = NULL; if(NULL == str) return; int len = strlen(str); m_str = new char[len+1]; strcpy(m_str,str); } ~String() { if(m_str) delete m_str; } String(const String& that) { m_str = NULL; if(that.m_str==NULL) { return; } int len = strlen(that.m_str); m_str = new char[len+1]; strcpy(m_str,that.m_str); } String &operator=(const String& that) { if(&that != this) { String temp; swap(m_str,temp.m_str); } return *this; } const char* c_str(){return m_str;} };