Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void LinkedList::copy(const LinkedList& other)
- {
- Node* temp = other.head;
- if (temp != nullptr)
- {
- ++n;
- Node* localTemp = head = new Node(temp->data);
- while (temp->next)
- {
- localTemp->next = new Node(temp->next->data);
- ++n;
- temp = temp->next;
- localTemp = localTemp->next;
- }
- }
- else
- head = nullptr;
- }
- void Queue::copy(const Queue& other)
- {
- for (Node* temp = other.head; temp; temp = temp->next)
- addBack(temp->data);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement