I have a function that takes the following argument
void func(void (*otherFunc)());
and I have a class constrat like this (.h file):
class DataReciver {
public:
DataReciver(uint8_t pinClk, uint8_t pinDIO);
void onReciveData();
uint8_t readData();
private:
uint8_t m_pinClk;
uint8_t m_pinDIO;
uint8_t m_bitIndex;
uint8_t m_byteData;
};
In the DataReciver
constrator creation in the .cpp file, I want to pass the this->onReciveData
function to func
, Something like func(this->onReciveData)
.
When I tried that, I recived an error "a pointer to a bound function may only be used to call the function".
Is that posible somehow to pass that function to func
? Thank you!
Note - I can not rewrite the func
function to take another arguments, it is given to me by someone else library.