title: C++ : Class & callbacks issue
body: <p>Here is my code &amp; requirements:</p>
  
  <p>I have 2 classes A &amp; B, they don't have any inheritance. I used one method of class A to call one method of Class B. Then the class B's method should callback one of the class A's method to execute a callback. </p>
  
  <p>Part of code:</p>
  
  <p>classA.h:</p>
  
  <pre><code>#include "classB.h"
  
  class classA
  {
    public:
    classA();
    classB *pClassB;
    void callClassB();
    void callBack();
  };
  </code></pre>
  
  <p>classA.cpp:</p>
  
  <pre><code>#include "classA.h"
  classA::classA()
  {
    pClassB = new classB();
  }
  
  void classA::callBack()
  {
    return;
  }
  
  void classA::callClassB()
  {
    pClassB-&gt;callFunction();
  }
  </code></pre>
  
  <p>classB.h:</p>
  
  <pre><code>class classB
  {
    public:
    classB();
    void callFunction();
  }
  </code></pre>
  
  <p>classB.cpp:</p>
  
  <pre><code>#include "classB.h"
  classB::classB()
  {
  }
  
  void classB::callFunction()
  {
     // I should call classA's callback here!
  }
  </code></pre>
  
  <p>The problem is, I can't include classA.h in classB.h because it will cause some compile issue elsewhere(I can't solve that). I can't make classB as classA's subclass(if I can, I just have to do <code>classA::callBack()</code> instead). So is there a solution to this situation?</p>
  
  <p>UPDATE：that's what I've modified:</p>
  
  <pre><code>class classB
  {
    public:
    classB(classA&amp; pCallBack);
    void callFunction();
    void (classA::*m_callback)(void);
  };
  
  classA::classA()
  {
    pClassB = new classB(*this);
  }
  
  classB::classB(classA&amp; pCallBack)
  {
    m_callback = pCallBack;
  }
  </code></pre>
  
  <p>I tried to save the pointer, but also failed. It says "assigning from incompatible type"... what's wrong with it??</p>