anyone can help me with a class for a single linked list with constructors?
I need to do a single linked list, the list nodes will with one data and next pointer. I have to use default constructor, copy constructor etc. so far i have class list{ public: list(): next(NULL) {} // default constructor list(const list &t){} // copy constructor list& operator= (const list &t) // assignment operator ~list(){} //destructor void print() private: struct Node { data x; Node *next; }_list;
oki so i got some part done http://liveworkspace.org/code/1ae962b5e584877637a3c82110381a49
but i don't know how to do a copy constructor and copy assignment constructor
and also why does the destructor is printed twice?
Join our real-time social learning platform and learn together with your friends!