I've been coddled by lazier languages for so long that I can't believe how much c++ I've forgotten...
I'm trying to make a class that calls a function at a later time. I have something that looks like this:
class SimpleClass{
public:
SimpleClass(){}
void start(void (*fn)()){
actionFunction = fn;
}
void trigger(){
actionFunction();
}
private:
FunctionPointer actionFunction;
};
I get a compile error on the trigger() function:
"Call of an object of a class type without appropriate operator() or conversion functions to pointer-to-function type (E980)"
My question: What do I need to do in trigger() to call the function passed in start()? Everything that makes sense to me returns more errors.
I've been coddled by lazier languages for so long that I can't believe how much c++ I've forgotten...
I'm trying to make a class that calls a function at a later time. I have something that looks like this:
I get a compile error on the trigger() function:
"Call of an object of a class type without appropriate operator() or conversion functions to pointer-to-function type (E980)"
My question: What do I need to do in trigger() to call the function passed in start()? Everything that makes sense to me returns more errors.