I have some 3rd-part code:
class A(){
public:
void assingOnClickFunction(void (*function)();
};
I cannot change anything in that code.
I want to pass to that A::assingOnClickFunction()
my method of class B, void B::someFunction()
. I have tried (all inside of the B class!):
a->assingOnClickFunction(this->someFunction);
But I get the error:
function call missing argument list; use '&B::someFunction' to create a pointer to member
So I have changed it to:
a->assingOnClickFunction(&B::someFunction);
But now there is ofc the error about the different types: (void(*)()
and (&B::*)()
I cannot make B::someFunction()
static (it uses a lot of non-static B
's members and methods)!
So, is there an option to pass my B::someFunction()
to the A::assingOnClickFunction()
, not changing it to static and not changing anything in A
class (A
is not and cannot be aware of B
, B
includes A
)?