title: C++ Inherit class with sending modified parameters to parent's constructor
body: <p>I want to create class inheritance, where my new class creates object of parent class, setting some default parameters (which are pointers to other objects).</p>
  
  <p>At the beginning I had:</p>
  
  <pre><code>btDefaultCollisionConfiguration* collisionConfiguration =
          new btDefaultCollisionConfiguration();
  btCollisionDispatcher* dispatcher = new btCollisionDispatcher(collisionConfiguration);
  btVector3 worldAabbMin(-1000,-1000,-1000);
  btVector3 worldAabbMax(1000,1000,1000);
  
  btAxisSweep3* broadphase = new btAxisSweep3(worldAabbMin,worldAabbMax);
  
  colWorld = new btCollisionWorld(dispatcher,broadphase,collisionConfiguration);
  colWorld-&gt;setDebugDrawer(dbgdraw);
  </code></pre>
  
  <p>I want to have something like:</p>
  
  <pre><code>colWorld = new myBtCollisionWorld(dbgdraw);
  </code></pre>
  
  <p>I tried many things and invented a trick</p>
  
  <pre><code>btVector3 worldAabbMin;
  btVector3 worldAabbMax;
  
  class BtOgreCollisionWorld_initializer { //A trick: we need one more constructor to
      // initialize default variables; Then we will pass them to btCollisionWorld
      // as it stands next in inheritance list
  public:
      BtOgreCollisionWorld_initializer(btCollisionDispatcher *&amp;dispatcher,
          btAxisSweep3 *&amp;broadphase,
          btDefaultCollisionConfiguration *&amp;collisionConfiguration)
      {
          if (!worldAabbMin) worldAabbMin = btVector3(-1000,-1000,-1000);
          if (!worldAabbMax) worldAabbMax = btVector3(1000,1000,1000);
          if (!collisionConfiguration)
              collisionConfiguration = new btDefaultCollisionConfiguration();
          if (!dispatcher)
              dispatcher = new btCollisionDispatcher(collisionConfiguration);
          if (!broadphase) broadphase = new btAxisSweep3(worldAabbMin,worldAabbMax);
      };
  };
  
  class BtOgreCollisionWorld: public BtOgreCollisionWorld_initializer,
          public btCollisionWorld {
  public:
      //using btCollisionWorld::btCollisionWorld;
      BtOgreCollisionWorld(BtOgre::DebugDrawer *dbgdraw,
          btCollisionDispatcher* dispatcher = 0, btAxisSweep3* broadphase = 0,
          btDefaultCollisionConfiguration* collisionConfiguration = 0)
          : BtOgreCollisionWorld_initializer(dispatcher, broadphase,
              collisionConfiguration),
          btCollisionWorld(dispatcher, broadphase, collisionConfiguration)
      {
          /*copying variables above*/
          this-&gt;setDebugDrawer(dbgdraw);
      };
  protected:
      btDefaultCollisionConfiguration* collisionConfiguration;
      btCollisionDispatcher* dispatcher;
      btVector3 worldAabbMin;
      btVector3 worldAabbMax;
      btAxisSweep3* broadphase;
  };
  </code></pre>
  
  <p>The idea behind this was that "initializer" class constructor is called first and overwrites the variables for btCollisionWorld class.</p>
  
  <p>And suddenly it worked.</p>
  
  <p>I understand that it may seem as an attempt to start a pointless discussion, but I'm not skilled at c++ and really haven't found anything like that while googled for it; so I'm just curious if there are any possible pitfalls or other ways to implement this.</p>