-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBinaryNode.cpp
More file actions
45 lines (37 loc) · 749 Bytes
/
Copy pathBinaryNode.cpp
File metadata and controls
45 lines (37 loc) · 749 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
#include "BinaryNode.h"
template<class T>
BinaryNode<T>::BinaryNode( T value )
{
m_data = value;
for( unsigned int i = 0; i < m_nChildren; ++i )
{
m_children[i] = nullptr;
}
m_isRoot = false;
}
template<class T>
T BinaryNode<T>::getValue() const
{
return m_data;
}
template<class T>
void BinaryNode<T>::setLeftChild( BinaryNode<T>* left )
{
m_children[LEFT] = left;
}
template<class T>
void BinaryNode<T>::setRightChild( BinaryNode<T>* right )
{
m_children[RIGHT] = right;
}
template<class T>
BinaryNode<T>* BinaryNode<T>::getLeftChild()
{
return m_children[LEFT];
}
template<class T>
BinaryNode<T> *BinaryNode<T>::getRightChild()
{
return m_children[RIGHT];
}
template class BinaryNode<int>;