Updated Generic Nodes to have public properties

This commit is contained in:
Luke Else 2022-11-15 07:29:37 +00:00
parent 05d637acb5
commit 25091543a2
2 changed files with 10 additions and 11 deletions

View File

@ -8,17 +8,17 @@ namespace Generic {
public:
DirectedNode(T value, std::shared_ptr<NodeType> left = nullptr, std::shared_ptr<NodeType> right = nullptr);
~DirectedNode();
T value;
std::shared_ptr<NodeType> left;
std::shared_ptr<NodeType> right;
protected:
T mValue;
std::shared_ptr<NodeType> mLeft;
std::shared_ptr<NodeType> mRight;
};
template <typename T, typename NodeType>
DirectedNode<T, NodeType>::DirectedNode(T value, std::shared_ptr<NodeType> left, std::shared_ptr<NodeType> right) {
this->mValue = value;
this->mLeft = left;
this->mRight = right;
this->value = value;
this->left = left;
this->right = right;
}
template <typename T, typename NodeType>

View File

@ -8,15 +8,14 @@ namespace Generic {
public:
UndirectedNode(T value, std::shared_ptr<NodeType> next = nullptr);
~UndirectedNode();
protected:
T mValue;
std::shared_ptr<NodeType> mNext;
T value;
std::shared_ptr<NodeType> next;
};
template <typename T, typename NodeType>
UndirectedNode<T, NodeType>::UndirectedNode(T value, std::shared_ptr<NodeType> next) {
this->mValue = value;
this->mNext = next;
this->value = value;
this->next = next;
}
template <typename T, typename NodeType>