title: Cannot get a node pointer to point to another node in a doubly linked list
body: <p>I am working on a project that requires me to simulate a list of clients that I can add and remove from both the front and the rear of a line. I've opted to use a doubly-linked list data structure for this and have created two classes, Client and ClientLine to accomplish it. The header for both my classes can be seen below.</p>
  
  <pre><code>    class Client
  {
  public:
  
  //Default constructor.
  //This constructor automatically fills the QueryTime private member
  //with a random value upon creation.
  Client();
  
  //***** setQueryTime *****
  //A function to set the QueryTime private member to a specific value.
  void setQueryTime(float SetTime);
  
  //***** getQueryTime *****
  //A function to get the private member, QueryTime.
  float getQueryTime();
  
  private:
  
  //A variable to hold the time it will take the secretary to answer
  //the question.
  float QueryTime;
  
  }; //class Client
  
  
  class ClientLine
  {
  public:
  
  //A node to go into the list of clients.
  typedef struct{
  
      struct clientNode *next; //Points to the next node in the list
      struct clientNode *prev; //Points to the previous node in the list
      Client currentClient; //The client in the current spot in line.
      int clientType; //Tells whether the client is in person or on the phone.
  
  } clientNode;
  
  //Default constructor
  //Creates an empty doubly-linked list to represent a
  //line of clients (phone and in person).
  ClientLine();
  
  //***** isLineEmpty *****
  //Boolean function to tell if there is nobody in line.
  //The line is empty if listHeader-&gt;front == listHeader-&gt;rear == NULL.
  bool isLineEmpty();
  
  //***** addClientRear *****
  //Adds a new client to the rear of the line.
  void addClientRear(Client newClient, int clientType);
  
  //***** addClientFront *****
  //Adds a new client to the front of the line.
  void addClientFront(Client newClient, int clientType);
  
  //***** removeClientRear *****
  //Deletes the node at the rear of the list and returns the client from it.
  Client removeClientRear();
  
  //***** removeClientFront *****
  //Deletes the node at the front of the list and returns the client from it.
  Client removeClientFront();
  
  private:
  
  clientNode *front; //Pointer to the front of the list
  clientNode *rear; //Pointer to the rear of the list
  int listLength; //A variable to hold the length of the list.
  
  }; //class ClientLine
  </code></pre>
  
  <p>In my addClientRear member function, I try to assign the pointers in the new node to point to the previous node in the list as needed using this code:</p>
  
  <pre><code>//***** addClientRear *****
  //Adds a new client to the rear of the line.
  void ClientLine::addClientRear(Client newClient, int clientType){
      //Make a new node to contain the client.
      clientNode *newNode = new clientNode;
      newNode-&gt;currentClient = newClient;
      newNode-&gt;clientType = clientType;
  
      //Set the pointers in the new node and list as needed.
      if(isLineEmpty()){
          front = newNode;
          rear = newNode;
          newNode-&gt;next = NULL;
          newNode-&gt;prev = NULL;
      }
  
      else{
          newNode-&gt;prev = rear;
          newNode-&gt;next = NULL;
      }
  
      listLength += 1; //increase the length of the list by one.
  } //addClientRear()
  </code></pre>
  
  <p>However I get an error on the statement newNode->prev = rear that says: </p>
  
  <blockquote>
    <p>a value of type "ClientLine::clientNode *" cannot be assigned to an entity of type "clientNode *"</p>
  </blockquote>
  
  <p>I'm not sure why I get this error since I'm trying to assign a pointer value into another pointer. Any advice would be much appreciated.</p>