title: Establishing an Entry Class for a Linked List
body: <p>I have a new project where I am creating a class for an entry in a doubly linked list. I am utilizing object-oriented style, which I have limited experience with. The constructors and functions were defined in a separate file.</p>
  
  <p>Header File:</p>
  
  <pre><code>#ifndef LISTENTRY_H_JDP
  #define LISTENTRY_H_JDP
  
  #include "DATAClass.h"
  #include &lt;iostream&gt;
  
  using namespace std;
  
  typedef DATAClass l;
  typedef class LISTEntry *listptr;
  
  class LISTEntry
  {
    DATAClass data;
    listptr prev;
    listptr next;
  
  public:
    LISTEntry();
    LISTEntry(DATAClass l);
    LISTEntry(LISTEntry &amp;le);
    ~LISTEntry();
  
    LISTEntry getNext();
    void setNext();
  
    LISTEntry getPrev();
    void setPrev();
  
    DATAClass getData();
    void setData(DATAClass d);
  };
  
  #endif // LISTENTRY_H_INCLUDED
  </code></pre>
  
  <p>Implementation File:</p>
  
  <pre><code>#include "LISTEntry.h"
  
  LISTEntry::LISTEntry()
  {
      data = data;
      prev = NULL;
      next = NULL;
  }
  
  LISTEntry::LISTEntry(DATAClass l)   //take an item of type l and convert it into a LISTEntry
  {
      data = l;
      prev = NULL;
      next = NULL;
  }
  
  LISTEntry::LISTEntry(LISTEntry &amp;le)
  {
      data = le.getData();
      prev = le.getPrev();
      next = le.getNext();
  }
  
  LISTEntry::~LISTEntry()
  {
  }
  
  LISTEntry LISTEntry::getNext()
  {
      return *next;
  }
  
  void LISTEntry::setNext()
  {
      next = new LISTEntry;
  }
  
  LISTEntry LISTEntry::getPrev()
  {
      return *prev;
  }
  
  void LISTEntry::setPrev()
  {
      prev = new LISTEntry;
  }
  
  DATAClass LISTEntry::getData()
  {
      return data;
  }
  
  void LISTEntry::setData(DATAClass d)
  {
      data = d;
  }
  </code></pre>
  
  <p>The issue is my copy constructor, LISTEntry(LISTEntry &amp;le). So far, I receive the error:</p>
  
  <blockquote>
    <p>cannot convert 'LISTEntry' to 'listptr {aka LISTEntry*}'</p>
  </blockquote>
  
  <p>I am also unsure about the get and set functions. I want them to link to new entries of the same type in the list. I guess I am having trouble with the implementation of pointers in the constructor. Can anyone help out? </p>