Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue#6 added destructors for node.h and list.h #7

Merged
merged 1 commit into from Oct 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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