title: How do you use access the information from a string*?
body: <p>I am using a doubly linked list and I am trying to use the data that is   passed by reference to insert a node before said data. I've used <code>string* data = new string(s);</code> to allocate memory however, when I try to use data I get an error. </p>
  
  <pre><code>    #ifndef __DOUBLYLINKEDLIST_H__
      #define __DOUBLYLINKEDLIST_H__
      //
      //
      #include
      #include
      using namespace std;
  
      class DoublyLinkedList {
      public:
        DoublyLinkedList();
        ~DoublyLinkedList();
        void append (const string&amp; s);
        void insertBefore (const string&amp; s);
        void insertAfter (const string&amp; s);
        void remove (const string&amp; s);
        bool empty();
        void begin();
        void end();
        bool next();
        bool prev();
        bool find(const string&amp; s);
        const std::string&amp; getData() const;
  
      private:
        class Node
        {
        public:
        Node();
        Node(const string&amp; data);
        ~Node();
        Node* next;
        Node* prev;
        string* data;
        };
        Node* head;
        Node* tail;
        Node* current;
        };
  
    void DoublyLinkedList::insertBefore(const string&amp; s)
    {
    Node* ptr = head;
    string* data = new string(s);
    if (head == NULL)
     { 
          append(s);
          return;
    }
    if (head == current)
    {
          //this is where I get an error...
          this-&gt;data= new Node();
          current-&gt;prev = head;
          current = head;
          return;
  
    }
  </code></pre>