no matching function for call to 'Ticker::Ticker(void (&)(), int)'
时间: 2024-05-10 14:20:34 浏览: 204
This error message typically indicates that there is no constructor defined for the Ticker class that takes a function pointer as an argument.
To fix this error, you need to define a constructor for the Ticker class that takes a function pointer as an argument. Here's an example:
```
class Ticker {
public:
Ticker(void (*function)()): _function(function) {}
void tick() {
_function();
}
private:
void (*_function)();
};
```
In this example, the Ticker class takes a function pointer as an argument to its constructor. The function pointer is then stored as a member variable, and can be called by the tick method.
With this constructor defined, you should be able to create a Ticker object and pass in a function pointer as an argument without encountering the "no matching function for call" error.
阅读全文