Update 重要.cpp

赋值运算符重载拷贝的dest和src反了
This commit is contained in:
zhkgo
2022-03-18 17:08:48 +08:00
committed by GitHub
parent 696b01a42c
commit bdde117539

View File

@@ -21,7 +21,7 @@ public:
const String &operator=(const String &R)
{
length = R.length;
strcpy(R.sPtr, sPtr);
strcpy(sPtr, R.sPtr);
return *this;
}; //重载赋值运算符 =
const String &operator+=(const String &R); //字符串的连接 +=