For example : in class A there is a public function pointer to the function B. How make function B can access to the private members or public members of class A; Code :
Code:
class A
void B1 ()
{
Item_ = 10;
TestMemberF();
std::cout << "B Function Workd" << std::endl;
}
class A1
{
private :
void func1()
{
std::cout << "F1 works" << std::endl;
}
void func2()
{
std::cout << "F2 works" << std::endl;
}
int Item_ = 5;
void (*ArgFunc)();
void TestMemberF() { std::cout << "Test member func";}
public :
void DefineFunc(void (*Arg)())
{
ArgFunc = Arg;
}
void ExecutFunc()
{
ArgFunc();
}
};
How to make function B can access to TestMember and Item_?