Doubt in class code (regarding pointer type)

in this class code

PLEASE HELP ME WITH THESE DOUBTS,I CANT FIND THEIR SOLUTION ON INTERNET:

1st doubt:
why make a pointer of T type by node < T > *next when we are just pointing to a node
i mean why ,why not of node type i mean node * next

2nd doubt:
template < typename T > has been written twice,please tell me why wont that give us an error bcoz generally multiple declaration of something gives us error

3rd doubt:
In node < T > *next ,can i use int or float or any other datatype instead of node ,please give me reason ,why or why not

4th doubt:
why not use simply use declare pointer by T *next (pointer to T datatype variable) instead of node < T > *next ,

  1. this is because your data type is not fixed for the node, that’s why you declare it as Node < T > *next;
  2. template < typename T > has been written twice, first is for class Node and 2nd is for class Hashtable, everytime you define a class which uses variables of type T you have to declare template < typename T > first, otherwise it will result in an error.
  3. You can declare it as Node *next; or Node < T > *next; if you write int string or something else in place of T it will give you an error, as the pointer next can be of one data type either Node, int, string or anything. Remember here pointer points no next Node not any int, string, etc. variable.
  4. Because here the pointer is of type Node not of data type T

i dont understand the difference between the pointers
Node < T > *next; and node * next;

just understood the my recent above mentioned doubt

THANKS A LOT FOR HELPING ME :grin:

Great :+1: Keep Coding :slightly_smiling_face: