print address of virtual member function
Posted
by hidayat
on Stack Overflow
See other posts from Stack Overflow
or by hidayat
Published on 2010-06-18T08:29:53Z
Indexed on
2010/06/18
8:33 UTC
Read the original article
Hit count: 254
I am trying to print the address of a virtual member function. If I only wants to print the address of the function I can write:
print("address: %p", &A::func);
But I want to do something like this:
A *b = new B();
printf("address: %p", &b->func);
printf("address: %p", &b->A::func);
however this does not compile, is it possible to do something like this even do looking up the address in the vtable is done in runtime?
© Stack Overflow or respective owner