title: Passing a vector of object pointers to a class (C++)
body: <p>I have a vector of Object pointers.</p>
  
  <pre><code>std::vector&lt;myObject *&gt; listofObjects;
  </code></pre>
  
  <p>And I want to pass them to another object that needs access to them.</p>
  
  <p>When I try to do something like the following:</p>
  
  <pre><code>class NeedsObjects 
  {
   public:
      NeedsObjects(std::vector&lt;myObject *&gt; &amp;listofObjects)
   private:
      std::vector&lt;myObject *&gt; &amp;listofObjects;
  };
  </code></pre>
  
  <p>And then initialize the vector in the initialization list I get the following errors:</p>
  
  <pre><code>'myObject' was not declared in this scope
  template argument 1 is invalid
  template argument 2 is invalid
  </code></pre>
  
  <p>What am I doing wrong? All I want to do is pass a vector to the NeedsObjects class.</p>