I am having issues trying to pass a function as an argument in another object's function. I am well aware there are many similar topics but I either can't get their solution to work or can't understand them.
class foo
{
public:
void func1(void (*Drawing)(void));
template<class T>
void func2(void (T::*Drawing)(void));
};
class bar
{
private:
foo myFoo;
void Drawing();
void func3() {
// Attempt 1
myFoo.func1(Drawing);
// Attempt 2
myFoo.func2<bar>(&bar::Drawing);
}
};
So in my first attempt, I get the error where you can't convert void (bar::*)(void)
to void (*)(void)
of which I then found out there are normal function pointers and member function pointers.
Attempt 2 was my feeble attempt to overcome this but I get unresolved externals now...
So how can I successfully pass my Drawing()
member function into another function from another object?