String::String(const char* str1)

{

this->len = strlen(str1) + 1;

this->str = new char[this->len];

strcpy(this->str, str1);

}

String::String(const String& ref)

{

this->len = ref.len;

this->str = new char[this->len];

strcpy(this->str, ref.str);

}

String::~String()

{

if (this->str != NULL)

delete[] this->str;

}

String& String::operator=(const String& ref)

{

if (this->str != NULL)

delete[] this->str;


this->len = ref.len;

this->str = new char[this->len];

strcpy(this->str, ref.str);

return*this;

}

bool String::operator==(const String& ref)

{

return strcmp(this->str, ref.str) ? true : false;

}


이런식으로요...