Replace void *disconnectFunc;
with void (*disconnectFunc)();
to declare function pointer type variable. Or even better use a typedef
:
typedef void (*func_t)(); // pointer to function with no args and void return
...
func_t fptr; // variable of pointer to function
...
void D::setDisconnectFunc( func_t func )
{
fptr = func;
}
void D::disconnected()
{
fptr();
connected = false;
}