title: Polymorphic object members
body: <p>I have the following problem. I have a base class and several classes inheriting from it. All those classes are sharing a very similar interface and will most probably not be required to overload most of the shared methods.</p>
  
  <p>However, all of them are using different member objects that are derived from each other and share a very similar interface too.</p>
  
  <pre><code>class BaseClass
  {
      protected:
          Com* com;
  
      public:
          void setReady()
          {
              com-&gt;setReady();
          }
  }
  
  class DerivedClass : BaseClass
  {
      protected:
          DerivedCom* com;
  }
  
  class Derived2Class : BaseClass
  {
      protected:
          Derived2Com* com;
  }
  </code></pre>
  
  <p>How can I enable <code>DerivedClass</code> to have <code>setReady()</code> run its version of <code>com</code> instead of the one inherited from <code>BaseClass</code>?</p>