123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- const char* MyString::CloneCString(const char* a_c_string) {
- if (a_c_string == nullptr) return nullptr;
- const size_t len = strlen(a_c_string);
- char* const clone = new char[len + 1];
- memcpy(clone, a_c_string, len + 1);
- return clone;
- }
- void MyString::Set(const char* a_c_string) {
-
- const char* const temp = MyString::CloneCString(a_c_string);
- delete[] c_string_;
- c_string_ = temp;
- }
|