title: How to pass a vector from a member function to another in the same class?
body: <p>I tried searching a lot but I couldn't find an answer. Almost every answer I found is about passing between two classes. </p>
  
  <p>My problem is that I want to declare and define a vector of strings in one member function, then I want another member function of the same class to modify said vector, and it's just not working out.  Here is my code: </p>
  
  <pre><code>void Game::draw_table(){
  
  std::vector&lt;std::string&gt; L(3);
  
  L[0] = "something";
  L[1] = "something else";
  L[2] = "yet another something";
  
  std::cout &lt;&lt; L[0] &lt;&lt; std::endl;
  std::cout &lt;&lt; L[1] &lt;&lt; std::endl;
  std::cout &lt;&lt; L[2] &lt;&lt; std::endl;
  }
  </code></pre>
  
  <p>and then I want this other member function to modify it: </p>
  
  <pre><code>void Game::play_game(){
  
  //some code
  
  if (coord1 == 1 &amp;&amp; coord2 == 1)
      L[0] = "new something";
  }      
  </code></pre>
  
  <p>A friend told me that since they're in the same class I shouldn't need to do anything but it keeps saying "Undeclared identifier L".</p>