Hi,
You could go with static class methods; here is an example using both global functions and static methods (they are pretty much the same thing):
typedef void(*ParamFunc)(int i);
void ExternalFunctionThatGetsPassedAsParam(int i)
{
i++;
}
class Goodies
{
public:
static void SomeFunction(ParamFunc p)
{
p(5);
}
};
class DoManyThings
{
public:
static void FunctionThatGetsPassedAsParam(int i)
{
i++;
}
};
int _tmain(int argc, _TCHAR* argv[])
{
ParamFunc p = ExternalFunctionThatGetsPassedAsParam;
Goodies::SomeFunction(p);
Goodies::SomeFunction(DoManyThings::FunctionThatGetsPassedAsParam);
return 0;
} For actual member methods you'll need a different approach as the Goodies class needs an actual object on which to call the function pointer ... you need templates for that.