From bdde1175396fdefd560587c194d2968a6c2ad043 Mon Sep 17 00:00:00 2001 From: zhkgo <39695505+zhkgo@users.noreply.github.com> Date: Fri, 18 Mar 2022 17:08:48 +0800 Subject: [PATCH] =?UTF-8?q?Update=20=E9=87=8D=E8=A6=81.cpp?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 赋值运算符重载拷贝的dest和src反了 --- practical_exercises/10_day_practice/day7/综合例题/重要.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/practical_exercises/10_day_practice/day7/综合例题/重要.cpp b/practical_exercises/10_day_practice/day7/综合例题/重要.cpp index 83545ee..8cbcc46 100644 --- a/practical_exercises/10_day_practice/day7/综合例题/重要.cpp +++ b/practical_exercises/10_day_practice/day7/综合例题/重要.cpp @@ -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); //字符串的连接 +=