in the video around 50 mins when node* is being declared why we need to write it as
node < T >*
and not just node*…
why we need to write< T > as it is the data type of value variable in the node…node itself cannot be of any data type…
LP Live Advanced - Hashinggg
hey @Prajawal-Pandey-2140320206067139, node is the name of the class(templated class here) which has T type of data. We have to specify the datatype while creating object or pointer to object when we are using templated class.
If you remember, while declaring vector of int type, we used vector v because vector can be of any datatype. Check STL of vector you will see vector v in declaration.
so can i create two classes with the same name node in a single program??
one templated and other with some fixed data type say int??
hey @Gaurav13998, No you cannot, when you try to create object for non templated class than compiler will expect templated argument(datatype)
Look here https://ide.codingblocks.com/s/93971
hey @Prajawal-Pandey-2140320206067139 if your query is resolved. Please mark this doubt as resolved and rate me on the basis of your experience.
rating option will appear when to mark this doubt as resolved