If I have a function pointer
MyFunctionPointer myFunctionPointer;
I can pass it parameters like:
myFunctionPointer(1,2);
I am looking to do something similar, but call a particular function on an object. I currently have something like this:
if(case1)
myObject.Case1();
else if(case2)
myObject.Case2();
Instead, is there any way to do something like:
myObject.myFunctionPointer();
?
Thanks,
David
If you declare a function pointer as a member function of a class then yes you can assign your function to that member function and then later call the function.
so if you declare a function pointer in your class
once you assign the method to a function you can call it as you desire:
e.g.