From 40a2c486d5cbc215ff24479fa5c4f085b5bc31e1 Mon Sep 17 00:00:00 2001 From: FengJungle Date: Wed, 13 Oct 2021 23:10:44 +0800 Subject: [PATCH] bugfix: fix memory leak issue --- 17.IteratorPattern/2.Code/Iterator.h | 1 + 17.IteratorPattern/2.Code/main.cpp | 1 + 2 files changed, 2 insertions(+) diff --git a/17.IteratorPattern/2.Code/Iterator.h b/17.IteratorPattern/2.Code/Iterator.h index b4e29bb..43e8d42 100644 --- a/17.IteratorPattern/2.Code/Iterator.h +++ b/17.IteratorPattern/2.Code/Iterator.h @@ -12,6 +12,7 @@ class Iterator { public: Iterator(){} + virtual ~Iterator(){} // 声明抽象遍历方法 virtual void first() = 0; virtual void last() = 0; diff --git a/17.IteratorPattern/2.Code/main.cpp b/17.IteratorPattern/2.Code/main.cpp index d28a86e..51b2c38 100644 --- a/17.IteratorPattern/2.Code/main.cpp +++ b/17.IteratorPattern/2.Code/main.cpp @@ -33,6 +33,7 @@ int main() system("pause"); delete tv; + delete remoteControl; return 0; } \ No newline at end of file