jokulmorder 4 Newbie Poster

hi i'm new and i've got this problem i can't figure out when overloading the assignment operator for a queue object.

here's what i've got so far:

nodeType<Type> *current, *newNode, *last; //pointers for adding nodes
  bool doneOnce=false;

  if(this!=&otherQueue){ //no self copying
    destroyQueue();
    

    if(otherQueue.queueFront==NULL) //if queue is empty, save some time
      queueFront=NULL;

    else{ //add the front node
      current=otherQueue.queueFront;  
      queueFront=new nodeType<Type>;
      queueFront->link=NULL;
      last=queueFront;
      current=current->link;
      
      while(current!=NULL){  //add the other nodes
	newNode=new nodeType<Type>;
	newNode->info=current->info;
	newNode->link=NULL;
	last->link=newNode;
	last=newNode;
	current=current->link;
      }
      queueRear=last; //set rear to the last node
    }
      
  }

This apparently works fine but there's a problem when the program executes; it will tell me the following after queue 2 has been set equal to queue 1 (using the assignment operator):

Front Node of Queue 2: 5
Queue 1: 5 9 16 4 2
Queue 2: 0 9 16 4 2

Which would be fine and dandy if only that 0 were 5. i have no idea what's wrong, i've been doing function definitions nearly all day and i just can't figure out what i messed up at. the same function is being used to print the 5 and the 0 and previous tests showed that the dequeue function was consistent.

thanks for any help

EDIT: answer was right under my nose v_v Apologies, i really am tired and a previous cut job went awry, i found that i had never set the head node to contain the information. thanks though if you read this.

jonsca commented: Excellent first post +4