Updated protection modifiers on generic nodes.

This commit is contained in:
Luke Else 2022-11-13 00:06:58 +00:00
parent 96d5eb8071
commit e76f3b452e
2 changed files with 14 additions and 16 deletions

View File

@ -8,18 +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;
private:
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->value = value;
this->left = left;
this->right = right;
this->mValue = value;
this->mLeft = left;
this->mRight = right;
}
template <typename T, typename NodeType>

View File

@ -6,18 +6,17 @@ namespace Generic {
class UndirectedNode
{
public:
UndirectedNode(T value, std::shared_ptr<NodeType> left = nullptr, std::shared_ptr<NodeType> right = nullptr);
UndirectedNode(T value, std::shared_ptr<NodeType> next = nullptr);
~UndirectedNode();
T value;
std::shared_ptr<NodeType> next;
private:
protected:
T mValue;
std::shared_ptr<NodeType> mNext;
};
template <typename T, typename NodeType>
UndirectedNode<T, NodeType>::UndirectedNode(T value, std::shared_ptr<NodeType> left, std::shared_ptr<NodeType> right) {
this->value = value;
this->next = next;
UndirectedNode<T, NodeType>::UndirectedNode(T value, std::shared_ptr<NodeType> next) {
this->mValue = value;
this->mNext = next;
}
template <typename T, typename NodeType>