title: C++ class member that requires a constructor parameter
body: <p>I'm getting confused:</p>
  
  <p><strong>Director.cpp</strong></p>
  
  <pre><code>class Director {
  
    public:
    Director() {
  
    }
  
    runScene(Scene _scene) {
      scene = _scene;
    }
  
    private:
    Scene scene; // &lt;-- Private member "scene" of type Scene.
  
  };
  </code></pre>
  
  <p><strong>Scene.cpp</strong></p>
  
  <pre><code>class Scene {
  
    public:
    Scene(int number) {
  
  
    }
  
  }
  </code></pre>
  
  <p>g++ says</p>
  
  <blockquote>
    <p>no matching function for call to 'Scene::Scene()'</p>
  </blockquote>
  
  <p>It seems like it is trying to initialise <code>scene</code>, which can't be done because there are no constructors that take no parameters. I'm still new to C++ - why is it trying to initialise that private member?</p>
  
  <p>I'm not sure what is going on. I tried changing <code>Scene scene;</code> to <code>Scene scene(int);</code>, which will just cause <code>runScene</code> to throw an error, because that would make the compiler think that <code>scene</code> is actually a function.</p>
  
  <p>All I want is my class to have a member property of type <code>Scene</code>, which I can change at any time. What am I doing wrong?</p>