if you didn't overload the =, it's only copying member per member, not making a copy of all your nodes. Maybe that's it, though I would have expected it to just pop successfully but leave the passed queue with hanging pointers.
Queue& Queue::operator=(const Queue& right) {
if (this != &right) { // check for self assignment
while (front) { // clear this object
node *temp = front;
front = front->next;
delete temp;
}
back = NULL;
for (node *p = right.front; p; p = p->next) // push right into this object
push_back(p->data);
}
return *this;
}
wow xD i an currently learning this xD
see i tryed doing it inside the function but this awsome xD now i see the point in using operator overloading lol