Skip to content

Commit

Permalink
Merge pull request #7 from zg3d/master
Browse files Browse the repository at this point in the history
Issue #6 added destructors for node.h and list.h
  • Loading branch information
utkarshpant committed Oct 9, 2020
2 parents f9aca80 + 96ba79a commit 28f7ce7
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
16 changes: 13 additions & 3 deletions telemetry/include/List.h
Expand Up @@ -5,8 +5,8 @@
#include <cstdlib>
#include <string>
#include "Node.h"
#include "..\exceptions\EmptyContainerException.h"
#include "..\exceptions\OutOfBoundsException.h"
#include "../exceptions/EmptyContainerException.h"
#include "../exceptions/OutOfBoundsException.h"

template <class T>
class List {
Expand Down Expand Up @@ -48,6 +48,15 @@ class List {
head = NULL;
tail = NULL;
}
virtual ~List() {

while(!empty()) {
pop();

}


}
};

template <class T>
Expand Down Expand Up @@ -283,4 +292,5 @@ Node<T>* List<T>::get_tail() {
return tail;
}

#endif

#endif
7 changes: 6 additions & 1 deletion telemetry/include/Node.h
Expand Up @@ -23,6 +23,11 @@ struct Node {
prev = NULL;
data = NULL;
}
virtual ~Node(){
next = NULL;
prev = NULL;

}
};

#endif
#endif

0 comments on commit 28f7ce7

Please sign in to comment.