I am new to event handling in C++ and got stuck at point where I am trying to call event handler functions from the object of the structure.
typedef struct TaskScheduler
{
uint32_t taskId;
uint32_t taskTimeoutInMs;
TaskState_t taskState;
TaskType_t taskType;
void (EventHandlers::*callback)(void);
uint32_t tasktime;
}Task_t;
class Handler
{
public:
void registerTask(uint32_t taskId, void (EventHandlers::*callback)(void));
};
void EXTI2_Handler()
{
taskScheduler.*callback();
}
ERROR:must use '.' or '->' to call pointer-to-member function in 'task[((int)i)].Task::callback (...)', e.g. '(... ->* task[((int)i)].Task::callback) (...)' (task[i].callback());*
I am new to C++ and not able to resolve this error. i had seen other examples but now able to understand the resolution
Any help!