M
Matthew
I have a function pointer as a data member of a class MenuItem. I'd
like to be able to later set this function pointer to point to lots of
different functions, including member functions of other classes. I'm
going to only point to functions which take no arguments and have
return type void, but I don't want to be limited to pointing to member
functions of only one class. This would give me something like an
object oriented switch statement.
As I read more, I'm getting the sense that I can't have this much
freedom. It's not enough to restrict myself to just functions that
take no arguments and return void. If I'm going to be pointing to
member functions of a class, I have to specify the class.
Is this understanding of the limitiations of function pointers
correct?
Thank you for your time!
like to be able to later set this function pointer to point to lots of
different functions, including member functions of other classes. I'm
going to only point to functions which take no arguments and have
return type void, but I don't want to be limited to pointing to member
functions of only one class. This would give me something like an
object oriented switch statement.
As I read more, I'm getting the sense that I can't have this much
freedom. It's not enough to restrict myself to just functions that
take no arguments and return void. If I'm going to be pointing to
member functions of a class, I have to specify the class.
Is this understanding of the limitiations of function pointers
correct?
Thank you for your time!