GenericListNode.cpp
From Giona
(Difference between revisions)
Line 1: | Line 1: | ||
<pre> | <pre> | ||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | + | /**************************************************************************** | |
- | + | *Generic List Node for a Linked List. | |
+ | *Author: Rosario Marino | ||
+ | ***************************************************************************/ | ||
+ | |||
#include "GenericListNode.h" | #include "GenericListNode.h" | ||
Line 25: | Line 22: | ||
GenericListNode::~GenericListNode() | GenericListNode::~GenericListNode() | ||
{ | { | ||
- | + | if(this->elem) | |
- | + | delete(this->elem); | |
} | } | ||
Revision as of 11:34, 13 December 2007
/**************************************************************************** *Generic List Node for a Linked List. *Author: Rosario Marino ***************************************************************************/ #include "GenericListNode.h" /* * Constructor */ GenericListNode::GenericListNode() { this->next = NULL; this->elem = NULL; } /* * Destructor */ GenericListNode::~GenericListNode() { if(this->elem) delete(this->elem); } /* * Sets the element of the node */ void GenericListNode::setElem(genericListElemT elem) { this->elem = elem; } /* * Returns the element of the node */ genericListElemT GenericListNode::getElem() { return this->elem; } /* * Sets next node in the list */ void GenericListNode::setNext(GenericListNode *next) { this->next = next; } /* * Returns next node in the list */ GenericListNode* GenericListNode::getNext() { return this->next; }