From df4294e6b85bcfa80b74bf2002b3456a1798fa33 Mon Sep 17 00:00:00 2001 From: FengJungle Date: Wed, 9 Mar 2022 23:09:06 +0800 Subject: [PATCH] set released pointer to nullptr. --- 09.CompositePattern/2.Code/main.cpp | 13 +++++++++++++ 12.FlyweightPattern/2.Code/main.cpp | 5 +++++ 14.ChainOfResponsibility/2.Code/main.cpp | 8 ++++++++ 3 files changed, 26 insertions(+) diff --git a/09.CompositePattern/2.Code/main.cpp b/09.CompositePattern/2.Code/main.cpp index e6a5b5e..6b516fa 100644 --- a/09.CompositePattern/2.Code/main.cpp +++ b/09.CompositePattern/2.Code/main.cpp @@ -56,5 +56,18 @@ int main() delete office7; delete office8; + head = nullptr; + sichuanBranch = nullptr; + cdBranch = nullptr; + myBranch = nullptr; + office1 = nullptr; + office2 = nullptr; + office3 = nullptr; + office4 = nullptr; + office5 = nullptr; + office6 = nullptr; + office7 = nullptr; + office8 = nullptr; + return 0; } \ No newline at end of file diff --git a/12.FlyweightPattern/2.Code/main.cpp b/12.FlyweightPattern/2.Code/main.cpp index db04f09..9840371 100644 --- a/12.FlyweightPattern/2.Code/main.cpp +++ b/12.FlyweightPattern/2.Code/main.cpp @@ -35,6 +35,11 @@ int main() delete device2; delete device3; delete device4; + factory = nullptr; + device1 = nullptr; + device2 = nullptr; + device3 = nullptr; + device4 = nullptr; system("pause"); return 0; diff --git a/14.ChainOfResponsibility/2.Code/main.cpp b/14.ChainOfResponsibility/2.Code/main.cpp index 499b5ea..86a61e8 100644 --- a/14.ChainOfResponsibility/2.Code/main.cpp +++ b/14.ChainOfResponsibility/2.Code/main.cpp @@ -37,6 +37,14 @@ int main() delete bill2; delete bill3; delete bill4; + zuzhang = nullptr; + bingge = nullptr; + chunzong = nullptr; + laoban = nullptr; + bill1 = nullptr; + bill2 = nullptr; + bill3 = nullptr; + bill4 = nullptr; system("pause"); return 0;