consolidate all repos to one for archive
This commit is contained in:
41
semester_2/programiranje_2/naloga0802/Node.h
Normal file
41
semester_2/programiranje_2/naloga0802/Node.h
Normal file
@@ -0,0 +1,41 @@
|
||||
#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
|
||||
Reference in New Issue
Block a user