I've never used function pointers before and I'm having some trouble getting my code to work. This is what I have
TestClass.h:
class TestClass
{
public:
void function1();
void function2();
void function3(void (*funcPtr)(void))
void function4();
};
TestClass.cpp
void TestClass::function1()
{
//CODE
}
void TestClass::function2()
{
//CODE
}
void TestClass::function3(void (*funcPtr)(void))
{
//CODE
funcPtr();
//CODE
}
void TestClass::function4()
{
function3(function1);
function3(function2);
}
This give me the error
"nonstandard form for taking the address of a member function
I tried to add TestClass:: infront of the *funcPtr but that gives me even more errors
void f(TestClass * obj, void (TestClass::* mf)()) { (obj->*mf)(); }and call it likef(this, &TestClass::function1).