-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNode.h
55 lines (42 loc) · 1.1 KB
/
Node.h
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
47
48
49
50
51
52
53
54
55
#ifndef __NODE_H__
#define __NODE_H__
#include <string>
using namespace std;
/* Class to be used for chain of nodes */
class Node
{
private:
string myData;
Node *myNext;
public:
/**
* Default constructor contains no data and no links to other nodes
*/
Node(){ myData = ""; myNext = NULL; };
/**
* Creates a new node containing a reference to the specified data
*/
Node(string o){ myData = o; myNext = NULL; };
/**
* Creates a new node containing a reference to the specified object and
* a reference to the specified node.
*/
Node(string o, Node *n){ myData = o; myNext = n; };
/**
* Sets this node to refer to the specified node
*/
void setNextNode(Node *n) { myNext = n; };
/**
* Returns the reference to the next node pointed to by this node
*/
Node *getNextNode() { return myNext; };
/**
* Sets the data stored in the node to the specified object
*/
void setData(string o) { myData = o; };
/**
* Returns the data stored in the node
*/
string getData() { return myData; };
};
#endif