title: C++ how to access struct in struct
body: <p>I got a question about structs.. C++ is not language what I'm learning but I have a need to do exercise..</p>
  
  <p>I have a struct like this:</p>
  
  <pre><code>struct List
  {
      int data;
      List* next;
  };
  </code></pre>
  
  <p>and I got class and methods with which I can add/remove/printout elements of the struct so for example to view elements I got method:</p>
  
  <pre><code>void Kopa::Print()
  {
      List *tmp = p;
      while (tmp != NULL)
      {
          cout &lt;&lt; tmp-&gt;data &lt;&lt; endl;
          tmp = tmp-&gt;next;
      }
      tmp.struktura;
  }
  </code></pre>
  
  <p>The question is, how can I add and access new struct in <strong>List</strong> struct?
  I guess it the struct will look smth like this but I don't understand how to access it with class methods..</p>
  
  <pre><code>struct List
  {
      int data;
      List* next;
  
      struct NewList
      {
          int data;
          NewList* next;
      };
  };
  </code></pre>