I have a class defined as
class modify_field
{
public:
std::string modify(std::string str)
{
return str;
}
};
Is there any way to store this function name inside a string in main function and then call it. I tried this but it's not working.
int main()
{
modify_field mf;
std::string str,str1,str2;
str = fetch_function_name(); //fetch_function_name() returns string modify
str2 = "check";
cout << str; //prints modify
str1 = str + "(" +str2 + ")";
mf.str1();
}
I know this is wrong. But I just want to know if there is any way to call a function name using variable.