ActionQueue& ActionQueue::operator =(const ActionQueue &rightSide) { clear(); ActionNode *otherNode; front = NULL; back = NULL; otherNode = rightSide.front; if(otherNode != NULL) { front = new ActionNode(otherNode->getData()); back = front; otherNode = otherNode->getLink(); } while(otherNode != NULL) { back->setLink(new ActionNode(otherNode->getData())); back = back->getLink(); otherNode = otherNode->getLink(); } length = rightSide.length; return *this; }
ActionQueue::ActionQueue(const ActionQueue &queueObject) { ActionNode *otherNode; front = NULL; back = NULL; otherNode = queueObject.front; if(otherNode != NULL) { front = new ActionNode(otherNode->getData()); back = front; otherNode = otherNode->getLink(); } while(otherNode != NULL) { back->setLink(new ActionNode(otherNode->getData())); back = back->getLink(); otherNode = otherNode->getLink(); } length = queueObject.length; }