I have a large code and I have an error in the middle of it. Here is a simplified version of the parts of the code that has the error.
And this is the error I get:
// Followings are declared in the header
struct Task {
public:
_COORD p1;
int p2;
object p3;
speed p4;
bool(Game::*function)(_COORD, int, object, speed);
};
std::vector<Task> tasks;
// Followings are defined in the source
void Game::timer() {
(some code here)
tasks[i].function(tasks[i].p1, tasks[i].p2, tasks[i].p3, tasks[i].p4); /*error here*/
expression preceding parentheses of apparent call must have (pointer-to-) function type.
}
void Game::explode(bool(Game::*function)(_COORD, int, object, speed), _COORD p1, int p2, object p3, speed p4) {
ExplodeTask task;
task.function = function;
task.p1 = p1;
task.p2 = p2;
task.p3 = p3;
task.p4 = p4;
tasks.push_back(task);
}
Does anyone know how to fix it?