title: C++ callback for non-static function between different classes
body: <p>I have a Class A which I intend to put in a shared library as it interacts with the device drivers.</p>
  
  <p>I have a Class B and may be C,D,E... in future which will use the class A using the shared library.</p>
  
  <p>I want a capability of setting a callback function in Class A so that when a specific event occurs a non-static members function of class B,C,D,E ... should be called by Class A.</p>
  
  <p>I searched on google for callback function in C++ but found that non-static member functions are not supported by C-style definition of callbacks.</p>
  
  <p>Can it be done using function pointers ?</p>
  
  <p>Kindly give some suggestions for callbacks in C++ which do not violate the OOPS concepts.</p>
  
  <p>I also came around a library called 'Boost' which offers similar functionality but I want to avoid the overhead of the extra library if possible. Is Boost recommended for callback function ?</p>
  
  <p><strong>EDIT :</strong> The B,C,D,E will not share any hierarchy and they will be completely independent classes. But all of them would have object of class A. And class A would also have a public function to set the callback function.</p>