title: Shadowing variables
body: <p>My question is about variables defined into classes. I show you my problem.</p>
  
  <p>I have defined this class:</p>
  
  <pre><code>class Measure {
  
  int N;
  double measure_set[];
  char nomefile[];
  double T;
  
  public:
      void get( );
      void printall( );
      double mean( );
      double thermal_comp( );
  };
  </code></pre>
  
  <p>I would like method get to do the following:</p>
  
  <ol>
  <li>read numbers from a .dat file and save into measure_set array;</li>
  <li>read user input and save it into variable T;</li>
  </ol>
  
  <p>Here is what I've done:</p>
  
  <pre><code>void Measure::get() 
  {   
      cout &lt;&lt; "Insert filename:" &lt;&lt; endl;
      cin &gt;&gt; nomefile;
      cout &lt;&lt; endl;
      cout &lt;&lt; nomefile &lt;&lt; endl;
      cout &lt;&lt; endl;
  
      int M=0;
      int nmax=50;
  
      ifstream f;
      f.open(nomefile);
      while(M&lt;nmax)
      {
          f &gt;&gt; measure_set[M];
          if(f.eof()) 
          break;
          M++;
      }
      f.close();
      N=M+1;
  
      cout &lt;&lt; "Insert temperature:" &lt;&lt; endl;
      cin &gt;&gt; T;
      cout &lt;&lt; endl;
  } 
  </code></pre>
  
  <p>What happens is that I've noticed that T is memorized in <code>measure_set[0]</code>. Why this happens and how can I write a working code? I'm not that expert in C++, using this only for computation purposes, although I could solve my problem in other ways I would like to learn how to make this work in C++. Thanks a lot!</p>