title: creating doubly linked list
body: <p>I want to just create the doubly linked list and check if it is empty. Please tell the mistake.
  ERROR shown is : In function empty(), head and tail are out of scope.
  Didn't work when define  as struct in class Dict.</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;fstream&gt;
  #include &lt;string&gt;
  using namespace std;
  
  class node
  {   public:
      string data;
      node* next;
      node* prev;
      friend class Dict;
  };
  
  class Dict
  {   public:
      bool empty();
      Dict();
      node* head;
      node* tail;
  
  };
  
  Dict::Dict()
  {   head=new node;
      tail= new node;
      head-&gt;next=tail;
      tail-&gt;prev=head;
  
  }
  
  bool empty()
  {
      return head-&gt;next==tail;
  }
  
  int main()
  {
      Dict my_list;
      if(my_list.empty())
          {cout&lt;&lt;"empty list"&lt;&lt;endl;}
      else
          {cout&lt;&lt;"Not empty"&lt;&lt;endl;}
  }
  </code></pre>