title: Print address of virtual member function
body: <p>I am trying to print the address of a virtual member function.
  If I know which class implements the function I can write:</p>
  
  <pre><code>print("address: %p", &amp;A::func);
  </code></pre>
  
  <p>But I want to do something like this:</p>
  
  <pre><code>A *b = new B();
  
  printf("address: %p", &amp;b-&gt;func); 
  printf("address: %p", &amp;b-&gt;A::func);
  </code></pre>
  
  <p>However this does not compile. Is it possible to do something like this, perhaps looking up the address in the vtable at runtime?</p>