I'm using libuv in a C++ program. I have two classes, A and B that inherit from C.
I use libuv and declared an instance of uv_signal_t
on C. Creating an instance of uv_signal_t
requires a callback to be passed. I can easily pass a lambda to the C function to go around the problem of references to static member functions:
const int32_t r = uv_signal_start(&this->signal, [](uv_signal_t *handle, int signum){}, SIGABRT);
But how can I provide a different implementation of the callback on each child class? Ideally I'd have some common code implemented on C.cpp and additional code on each child.
Update
To be clear, I cannot change the signature of the callback method, as it's defined by libuv. I could edit the source for libuv, but I'm not sure I want to go that deep.
I'll add a function pointer as a property to my class C and implement it as necessary on the derived classes. More here.