if anyone explain me why this code is not working and where I'm making mistakes:
Thanks very much!Code:#include <iostream> using namespace std; template <class T> struct Node { T*data; struct Node *next; }; template <class T> class List { private: struct Node *head; public: List():head(0){} ~List(){/*appropriate clean up*/} void insert_new(T); }; template <class T> void List<T>::insert_new(T dat) { Node *tmp=new Node; tmp->data=new T; *(tmp->data)=dat; if(!head) { head=tmp; return ; } tmp->next=head; head=tmp; } int main() { List<int> Head; Head.insert_new(1); }