I want to use some functions as arguments for another function.
I found out that it can be done using function pointers.
But the pointer must have the same type of argument and return values as the function being passed to it and I have 3 different functions with different arguments and/or return types.
Is there a way to make pointer to b able to point to various types of functions (without overloading the function)?
How would you call the function? How would you know from the pointer how many arguments need to be passed?
I know that it is possible for any one given function's structure, but I don't know if it is even possible for over two entirely different functions.
But if there is just one function: void Func( int (*func) (Date,int), int);
where Date is a class designed by me.
I was making a Date Calculator.
The function will Be going through the values returned by function, checking it with the int value returned and then give suitable output.
I haven't entirely coded the functions yet, but I have them planned out before me.
Well yes it can be done that way!
Can't Imagine why didn't this come to me.
Probably reading up too much of function pointers doesn't help me!
Thanks...