2

I have a polymorphic object like so:

shared_ptr<Retirer> retirerObj(make_shared<Retirer>());

and I invoke its polymorphic method:

retirerObj->coat();

I'd like to get the address of where the coat() implementation is located. I tried a few ways using the address of operator, didnt work and then I wondered if I had to use some nasty syntax like for function pointers.

How can I output the address of coat()?

Lightness Races in Orbit
  • 378,754
  • 76
  • 643
  • 1,055
user997112
  • 29,025
  • 43
  • 182
  • 361
  • 3
    why would you need to save the address to a file? The vtable is implementation specific so this wouldn't be a safe operation, in addition to this not every polimorphic function is just an address. Take a look here: http://stackoverflow.com/questions/3068144/print-address-of-virtual-member-function – Jack Mar 14 '15 at 15:05
  • Without changing the function implementation, right? – 5gon12eder Mar 14 '15 at 15:05

0 Answers0