From 73993206a7d9d7d0f89fa3af1a623a8f21e33154 Mon Sep 17 00:00:00 2001 From: thewalkers <61453774+Thewalkers2012@users.noreply.github.com> Date: Fri, 22 Jul 2022 23:04:28 +0800 Subject: [PATCH] =?UTF-8?q?=E5=86=85=E5=AD=98=E6=B3=84=E6=BC=8F=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Person 的 name 字段申请内存未释放 --- practical_exercises/key_exercises/中括号重载.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/practical_exercises/key_exercises/中括号重载.cpp b/practical_exercises/key_exercises/中括号重载.cpp index 23039bd..34225ac 100644 --- a/practical_exercises/key_exercises/中括号重载.cpp +++ b/practical_exercises/key_exercises/中括号重载.cpp @@ -5,6 +5,9 @@ struct Person { //职工基本信息的结构 double salary; char *name; + ~Person() { + delete []name; + } }; class SalaryManaege {