コード例 #1
0
ファイル: ActionQueue.cpp プロジェクト: richardszeto/Checkers
    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;
    }
コード例 #2
0
ファイル: ActionQueue.cpp プロジェクト: richardszeto/Checkers
    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;
    }