title: Access struct members inside a class private members?
body: <p>For Example:</p>
  
  <p><strong>graph.h</strong></p>
  
  <pre><code>#ifndef GRAPH_H
  #define GRAPH_H
  
  #include &lt;iostream&gt;
  #include &lt;string&gt;
  
  using namespace std;
  
  class graph
  {
  private:
      struct node
      {
          string name;
          int currentValue;
          struct node *next;
      };
      node* head;
  public:
      graph();
      ~graph();
  
      graph(string* newName, int* givenValue);
  }
  
  #endif
  </code></pre>
  
  <p><strong>graph.cpp</strong></p>
  
  <pre><code>#include "graph.h"
  
  graph::graph() {}
  
  graph::~graph() {}
  
  graph::graph(string* newName, int* givenValue)
  {
      //This is what I want to achieve
      this-&gt;node-&gt;name = newName;                    //Compile error
  }
  </code></pre>
  
  <p><strong>main.cpp</strong></p>
  
  <pre><code>#include "graph.h"
  #include &lt;iostream&gt;
  
  using namespace std;
  
  int main()
  {
      return 0; //Note I have not yet created a graph in main
  }
  </code></pre>
  
  <p>How can I access the <strong>struct node</strong> members for the function above?</p>
  
  <p><strong>This is the error:</strong></p>
  
  <pre><code>graph.cpp: In constructor ‘graph::graph(std::string*, double*)’:
  graph.cpp:24:8: error: invalid use of ‘struct graph::node’
  this-&gt;node-&gt;label = newName;
  </code></pre>