Function Pointer

Started by
3 comments, last by MrBeaner 21 years, 5 months ago
Can i overload a function pointer?
------------------------------------------VOTE Patrick O'GradyWrite in Presidential CandidateThe Candidate who Cares.
Advertisement
What exactly do you mean?
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 functionsint 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;}  
Chess is played by three people. Two people play the game; the third provides moral support for the pawns. The object of the game is to kill your opponent by flinging captured pieces at his head. Since the only piece that can be killed is a pawn, the two armies agree to meet in a pawn-infested area (or even a pawn shop) and kill as many pawns as possible in the crossfire. If the game goes on for an hour, one player may legally attempt to gouge out the other player's eyes with his King.
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.
/* Bullmax */-------------Reality has many forms : good and evil, black and white, yin and yang.
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...
------------------------------------------VOTE Patrick O'GradyWrite in Presidential CandidateThe Candidate who Cares.

This topic is closed to new replies.

Advertisement