title: How can I make a class implement an interface .... (C++)
body: <p>... when the class acutally does provide implementations for all abstract methods, but is not "formally" implementing the interface?</p>
  
  <p>Lets say I have the following: </p>
  
  <pre><code>class AInterface {
      public:
          virtual void mem_func()=0;
          virtual ~AInterface(){}
  };
  
  void AFunction(AInterface* i){};
  
  class BClass {
      public:
          void mem_func(){}
          virtual ~BClass(){}
  };
  </code></pre>
  
  <p>and I cannot change any of this but I want to use an object of class BClass to call AFunction. </p>
  
  <p>Actually, I would like to write something like</p>
  
  <pre><code>class MyABClass : public BClass,public AInterface {};
  </code></pre>
  
  <p>but this doesnt help (the class just inherits both methods and is abstract). I guess one way to do this is writing something like</p>
  
  <pre><code>class MyABClass : public AInterface {
      public:
          void mem_func(){a.mem_func();}
      private:
          BClass a;
  }
  </code></pre>
  
  <p>This works fine, but I wonder if it is possible to save some writing or if there is some better way to deal with this situation.</p>