-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathListNode.h
More file actions
46 lines (39 loc) · 926 Bytes
/
ListNode.h
File metadata and controls
46 lines (39 loc) · 926 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#ifndef listnode_h
#define listnode_h
template<class DATATYPE>
class ListNode
{
public:
ListNode(DATATYPE datavalue, ListNode* nextptr, ListNode* prevptr);
ListNode(const DATATYPE & item);
void setData(DATATYPE newData);
DATATYPE getData();
DATATYPE data; // data
ListNode<DATATYPE>* next; //not proper data hiding procedures, I know
ListNode<DATATYPE>* prev;
};
template<class DATATYPE>
ListNode<DATATYPE>::ListNode(DATATYPE datavalue = NULL, ListNode<DATATYPE>* nextptr = NULL, ListNode<DATATYPE>* prevptr = NULL)
{
this->data = datavalue;
this->next = nextptr;
this->prev = prevptr;
}
template<class DATATYPE>
ListNode<DATATYPE>::ListNode(const DATATYPE & item)
{
data = item;
next = NULL;
prev = NULL;
}
template<class DATATYPE>
void ListNode<DATATYPE>::setData(DATATYPE newData)
{
this->data = newData;
}
template<class DATATYPE>
DATATYPE ListNode<DATATYPE>::getData()
{
return this->data;
}
#endif