title: Implementing message in c++
body: <p>As you know, objective-c uses message expression to call member function(method), which means you can dynamically call member function in run-time. 
  I wanted to implement this message expression in c++ as class. So any classes can use message expression by inheriting and registering the their member function. 
  Here's simple example for what I'm trying to do.</p>
  
  <p><a href="https://i.stack.imgur.com/0v1fw.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/0v1fw.png" alt="enter image description here"></a></p>
  
  <p>in SomeClass.cpp</p>
  
  <pre><code>// class SomeeClass : public MyMessageExpression
  
  type SomeClass::method_name_of_SomeClass(){
     //code..
     registerFunc(method_name_of_SomeClass) //registerFunc will add the function pointer into the function table  
  }
  </code></pre>
  
  <p>And finally you can use like this,</p>
  
  <pre><code>SomeClass.sendMessge("method_name_of_SomeClass");
  </code></pre>
  
  <p>The problem I couldn't solve is that how I'm going to cast void pointer into <code>mothod_name_of_SomeClass</code>'s function pointer in run-time. How can I set variable function pointer in function table?</p>
  
  <p>In case <code>mothod_name_of_SomeClas</code> uses <code>stdcall</code> calling convention How can I implement this class?</p>