41 lines
710 B
C++
41 lines
710 B
C++
#ifndef NALOGA0802_NODE_H
|
|
#define NALOGA0802_NODE_H
|
|
|
|
template <typename T>
|
|
class Node{
|
|
private:
|
|
T value;
|
|
Node *next = nullptr;
|
|
public:
|
|
Node(T value, Node *next);
|
|
|
|
void setValue(T value);
|
|
|
|
void setNext(Node *next);
|
|
|
|
T getValue() const;
|
|
|
|
Node *getNext() const {
|
|
return next;
|
|
}
|
|
};
|
|
|
|
template<typename T>
|
|
Node<T>::Node(T value, Node *next) : value(value), next(next) {}
|
|
|
|
template<typename T>
|
|
void Node<T>::setValue(T value) {
|
|
Node::value = value;
|
|
}
|
|
|
|
template<typename T>
|
|
void Node<T>::setNext(Node *next) {
|
|
Node::next = next;
|
|
}
|
|
|
|
template<typename T>
|
|
T Node<T>::getValue() const {
|
|
return value;
|
|
}
|
|
|
|
#endif //NALOGA0802_NODE_H
|