diff options
-rw-r--r-- | list.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -12,6 +12,13 @@ struct List { T value; struct List<T> *next; + + ~List() + { + if (next == NULL) + return; + delete next; + } }; template <typename T> |