//Version 1
template <typename T>
class Node<T> {
private:
T data;
Node *next;
public:
Node(T data) {
this->data = data;
this->next = NULL;
}
};
//Version 2
template <typename T>
class Node {
private:
T data;
Node *next;
public:
Node(T);
};
template <typename T>
Node<T>::Node(T val) {
data = val;
next = NULL;
}
I am confused on what the difference is between making a class using version 1 compared to making a class using version 2. What is the preferred way, Version 1 or Version 2?