Advertisement
MaksNew

Untitled

Feb 14th, 2021
253
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.38 KB | None | 0 0
  1. template<typename T>
  2. SinglyLinkedList<T>::SinglyLinkedList(const SinglyLinkedList& other)
  3. {
  4.     this->size = other.size;
  5.     this->head = other.head;
  6.     Node<T>* current = this->head;
  7.     Node<T>* newcar;
  8.     while (current->pNext != nullptr)
  9.     {
  10.         newcar = new Node<T>;
  11.         newcar.data = other.data;
  12.         newcar.pNext = other.pNext;
  13.         newcar = newcar->pNext;
  14.         current = current->pNext;
  15.     }
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement