I was just wondering if it was possible to make an array of functions?
To roughly get an idea, here is some fake code:
In this case the output of the program would be
int function; //the array would be called 'function', have 2 slots, with the functions being int types
function(x) //the first function would take on the name function and take one argument
cout << x << endl;
function(y) //the second function would have name function and have one arg
cout << y*y << endl;
function(1); //x = 1 as an example
function(2); //y = 2 as an example
This is fake code that does not work. I was just curious if there was a way to do such a thing.
The advantage I'm looking for is to have indexed names for functions, which would make them easier to organize.
How is this done in C++?