title: How to initialize member objects that requires constructor parameters in derived classes?
body: <p>I would like to include a <code>Composed</code> object in my <code>Base</code> class, and have different derived classes have different configurations of it. However the <code>Composed</code> class requires parameter in constructor, and I don't have control over its architecture.</p>
  
  <p>The compiler is reporting an error because the parameter for <code>Composed</code> should be passed at the initialization of <code>Base</code> class. But I only want it to be initialized in derived classes. What should I do in this case?</p>
  
  <pre><code>class Base{
    public:
      Base(); //Error
    protected:
      Composed comp;
  };
  class Composed{
    public:
      Composed(int id):id(id);
    private:
      int id;
  };
  class Derived_1:public Base{
    public:
      Derived():comp(1234){};
  };    
  class Derived_2:public Base{
    public:
      Derived():comp(2345){};
  };   
  </code></pre>