title: linkList copy constructor and assignment operator
body: <p>I'm writing my node and list classes and everything works fine except when I include destructor , copy constructor and the assignment operator functions in the list class, and I don't know what is wrong with them or what I have miss not to include. </p>
  
  <pre><code>linklist::linklist()
      :firstNode(NULL),
      lastNode(NULL),
      nodeCount(0) {}
  
  linklist::~linklist()// destructor
  {
      node* current = firstNode;
      while( current != 0 ) {
          node* temp = current-&gt;getNextNode();
          delete current;
          current = temp;
      }
      firstNode = 0;
  }
  
  linklist::linklist(linklist &amp;L)// copy constructor
  {
      firstNode = NULL;
      nodeCount = 0;
      node* temp = L.firstNode;
      for(int i = 0; i &lt; L.getNodeCount(); i++)
      {
          push_back(temp);
          temp = temp-&gt;getNextNode();
      }
  }
  
  linklist&amp; linklist::operator=(const linklist&amp; L)// overloading assignemnt operator
  {
      linklist* LL;
      node* temp = L.firstNode;
      while( temp != NULL ) {
          LL-&gt;getLast();
          temp = temp -&gt; getNextNode();
      }
      return *LL;
  }
  </code></pre>