title: Variable was not declared in this scope?
body: <p>I'm getting this error in several methods for several variables (all of which are vectors):</p>
  
  <pre><code>error: ‘parent’ was not declared in this scope
  </code></pre>
  
  <p>I've tried wrapping my method implementations inside of "namespace DisjointSubsets { ... }", but that causes other problems. It seems to only do this for vectors, and I've tried adding a "#include vector" at the start of the cpp file, it didn't change anything.</p>
  
  <p>Here is the header file:</p>
  
  <pre><code>#ifndef UNIVERSE 
  #define UNIVERSE 
  #include &lt;vector&gt;
  class DisjointSubsets { 
      public :
          DisjointSubsets ( unsigned numberElements = 5 ) ;
          unsigned findDS ( unsigned ) ;
          bool unionDS ( unsigned , unsigned ) ;
      private :
          vector&lt;unsigned&gt; parent ;
          vector&lt;unsigned&gt; rank ;
          unsigned size ;
  } ;
  #include "DisjointSubsets.cpp"
  #endif
  </code></pre>
  
  <p>And here is an example of one of the methods I wrote in the cpp file (which has no #includes):</p>
  
  <pre><code>unsigned DisjointSubsets::findDS(unsigned index) {
      return parent[index];
  }
  </code></pre>
  
  <p>(Changed the method to be non-functional, but still illustrate the kind of line that would cause a problem. Just in case someone else working on the assignment stumbles across this.)</p>