title: absorb all functions B::f1(c,5) of a class then call it in a little different way d.f1(5)
body: <p>Does C++ have feature that absorb all functions of another class in some ways?      </p>
  
  <p>More specifically, <code>D</code> want to absorb all <code>B</code>'s functions that is <code>public</code> and have <code>C*</code> as the first parameter.</p>
  
  <pre><code>#include &lt;iostream&gt;
  using namespace std;
  
  class C{public: int va=2;};
  class B{
      public:    
      void f1(C* cPtr,int p,float q){  std::cout&lt;&lt;(cPtr-&gt;va+p)&lt;&lt;std::endl; }
      int f2(C* cPtr,std::string str){  std::cout&lt;&lt;(cPtr-&gt;va)&lt;&lt;std::endl; return cPtr-&gt;va+100; }
      //f3,f4, ....  
  };
  class D{//absorber
      public: static D construct(B* bPtr,C* cPtr){
          ????   
      }
      ?????  
  };
  
  int main() {
      C* cPtr=new C();
      B* bPtr=new B();
      D d=D::construct(bPtr,cPtr);
      d.f1(2,3.0);         //will call : bPtr-&gt;f1(cPtr,2,3.0)
      int k=d.f2("f2");    //will call : bPtr-&gt;f2(cPtr,"f2")
      return 0;
  }
  </code></pre>
  
  <p>I know that I can do it per-function, using <code>&lt;...&gt;</code> or manually.<br>
  Can I do it in a more automatic way (one piece of code, absorb all <code>f1,f2,...</code>)?      </p>
  
  <p>If I can't, are there any similar features?   </p>
  
  <p>I may use it to comfort some calling.<br>
  There might be question about this, but I don't know a correct keyword to search for them.     </p>
  
  <p>Solution using macro is acceptable, but not much desirable.<br>
  A short answer like "No, and there are no similar features." is OK.</p>