diff --git a/list.cpp b/list.cpp index da9ad4f..873dfe9 100644 --- a/list.cpp +++ b/list.cpp @@ -12,6 +12,13 @@ struct List { T value; struct List *next; + + ~List() + { + if (next == NULL) + return; + delete next; + } }; template