Is there any way to get the exact address of a function member? For example I have :
struct foo
{
void print() { printf("bla bla bla"); }
};
//////////////////////////////////////////////////////////////
unsigned int address = foo::print;
Is there any way to get the exact address of a function member? For example I have :
struct foo
{
void print() { printf("bla bla bla"); }
};
//////////////////////////////////////////////////////////////
unsigned int address = foo::print;
You can use the following syntax to declare the pointer to the member function:
In order to call non-static member function you will need an existing instance of that class:
I'm not sure what you mean by "exact address". There's certainly no way of putting any address in an
unsigned int
(which is smaller than a pointer on my machine). For that matter, there's no way of putting a pointer to a function in avoid*
. Again, I've used machines where pointers to a function were larger thanvoid*
. And finally, there's no way of putting a pointer to (non-static) member function into a pointer to function; pointer to member functions are almost always larger. Finally, given:mais call different functions, depending on the contents of
p
.So it's not at all clear what you're asking for.