Pointer to Function(names)
Hi,
in my c++-book is an example how to use pointer to functions:
Code:
compare(double, double);
(funcptr*)(double, double);
funcptr = compare;
(funcptr*)(double, double);
this would call compare. (I don't have the book here, so i am not 100% sure if the * belongs in front or at the end of funcptr.
My problem is now in my case:
Code:
string funcname = "compare";
funcptr = funcname;
Of course i can't just write it the same like above, since one is a pointer and one is a string object.
Anyone could help me, how i could make it work?
Thanks
Hork83
PS: Why I need this? i'd like to write less code due to the large if/case i would need to write for any possible option.