-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNode.cpp
More file actions
50 lines (40 loc) · 964 Bytes
/
Copy pathNode.cpp
File metadata and controls
50 lines (40 loc) · 964 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
47
48
49
50
// Author: Johanne Montano
// Course: SENG1120
// Student Number: c3336019
#include <cstdlib>
#include "Node.h"
// this class will be used as data holders for a linked list
// constructors
Node::Node(Node* next_node, Node* previous_node, value_type& object_data){
next = next_node;
previous = previous_node;
node_data = object_data;
}
// empty destructor
Node::~Node(){}
// setters
void Node::set_next(Node* next_){
next = next_;
}
void Node::set_previous(Node* previous_){
previous = previous_;
}
void Node::set_data(value_type& node_data_){
node_data = node_data_;
}
// getters - use const when we can and non const when we must alter the state of the object
const Node* Node::get_next() const{
return next;
}
const Node* Node::get_previous() const{
return previous;
}
Node* Node::getNext(){
return next;
}
Node* Node::getPrevious(){
return previous;
}
Node::value_type& Node::get_data(){
return node_data;
}