Is it possible to have function pointers in structs and classes? Here is the structure of the code I am trying to write:
Code:
struct function_pointer
{
int id;
int *func_1(int,...);
};
int func_2(int argument,...);
{
va_list arguments;
va_start(arguments,argument);
for (int i=0;i<argument;i++)
{
cout << va_arg(arguments,int);
}
va_end(arguments);
}
int main()
{
function_pointer x;
x.id = 10;
func_2(2,4,5);
x.func_1 = &func_2; //error line
x.func_1(2,2,5);
cin.get();
}
There is this error: invalid use of member (did you forget the `&' ?)
I've never seen it before now. Suggestions?