Jump to content
  • Advertisement

Archived

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

MrBeaner

Function Pointer

This topic is 5681 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Advertisement
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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!