I was writing implementation of Linked List
in the bellow code we have Node<T> * next;
and Node * next;
I think both are doing same as pointing to object of Node class or there is difference between them.
template<typename T>
class Node{
T data;
Node<T>* next;
Node * next;
Node()
{
next = nullptr;
}
Node(T val)
{
this->data = val;
next = nullptr;
}
};
There is no difference between
Node<T> * next;
andNode * next;
, if both are declared inside the class body.As stated here.
So the name
Node * next
is resolved intoNode<T>* next;
.