Here is my requirement:
Assume I have functions a, b, and c all with the same signature.
I need a, b, and c to *return* a pointer to either a, b, or c (based on some condition within each respective function)
Is this possible? If so, could you show me a quick example?
Edit:
(What I'm really stuck on is the return type. I've tried using a typedef but that doesn't seem to get me any closer)
Example:
Code:typedef (*foo)(); // obviously doesn't work because no return type specified foo bar1() { if(yes){return &bar1; } else{ return &bar2; } } foo bar2() { if(yes){return &bar2; } else{ return &bar1; } }



LinkBack URL
About LinkBacks


