I want to call a function that returns a pointer to the right function depending on what inputChar is. All the functions returned are void and take no parameters.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
pointerToVoidFunction Input::getKeyFunction(){
switch(inputChar){
//Enter
case 13:
return /*pointer to Input::Enter*/;
//Space
case 32:
return /*pointer to Input::Space*/;
//Backspace
case 8:
return /*pointer to Input::Backspace*/;
default:
returnnullptr;
}
}
I don't know what to type in the pointerToVoidFunction part or how to return the pointer. I haven't found a clear explanation that I could just implant so if you know anything, please let me know!