-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnode.cpp
More file actions
49 lines (42 loc) · 962 Bytes
/
node.cpp
File metadata and controls
49 lines (42 loc) · 962 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
//
// Created by Ricky Marly on 10/25/20.
//
#include "node.h"
node::node()//empty constructor with variables initialited to default
{
numberData = 0;
node* left;
node* right;
}
node::node(unsigned int newNumberData)//constructor with @1 parameter
{
this->numberData = newNumberData;
this->left = nullptr;//null pointer
this->right = nullptr;//null pointer
}
//different setters utilized
void node::setValue(int newNumberData)//setter of int
{
numberData = newNumberData;
}
node* node::getRight()//getter of right node
{
return right;
}
node* node::getLeft()//getter of left node
{
return left;
}
void node::setLeft(node* newLeftNode)
{
left = newLeftNode;
}
void node::setRight(node* newRightNode)
{
right = newRightNode;
}
//different getters utilized Tree node written in C++. Demonstrating the use & implementation of nodes using BST principles.
int node::getNumberData()//getter
{
return numberData;
}