Archived

This topic is now archived and is closed to further replies.

MrBeaner

Function Pointer

Recommended Posts

I don''t think you can, I think when you overload a function it''s really just several functions using the same name with different signatures, hence the same function can have several different addresses.


  
#include <cassert>


void Function(void) {}
void Function(int) {} // overloaded functions


int main(int argc, char *argv[])
{
void(*a)(void) = &Function;
void(*b)(int) = &Function; // got addresses from the same function


assert((void *)(a)!=(void *)(b)); // yet they are different


return 0;
}

Share this post


Link to post
Share on other sites
I think so, because the function pointer have parameters. So, if your function pointer keeps the same name but have different parameters, it should be overloaded...



/* Bullmax */
-------------
Reality has many forms : good and evil, black and white, ying and yang.

Share this post


Link to post
Share on other sites
Thanks... I just did a switch to have the user select the message type then assign the value of the member function of the class which returns the apporpriate message loop, i.e. PeekMessage or GetMessage...

Share this post


Link to post
Share on other sites