I am trying to make a vector of function pointers for a class Menu
.
But I don't know how to define it, since the pointers to the functions I want to add have different types of arguments and some don't have any at all.
What I envision is something like this:
vector<SomeReturnType(*)(SomeArgType)> functions;
Where I can add functions whose definitions are:
SomeReturnType function_1(Class_1 c1);
SomeReturnType function_2(Class_2 c2);
SomeReturnType function_3();
Adding just like this:
functions.push_back(function_1(object_of_Class_1));
functions.push_back(function_2(object_of_Class_2));
functions.push_back(function_3();
But that's obviously not possible. What is the best way to do this?
Thank you for your attention. Cheers!