Original Post
Greetings! I can never seem to fully wrap my head around function pointers, so every time I come back to them, I need help. Using VS 2005 Express, here's my setup. Class_C is the class that will have the function pointer (not shown). Ideally, for my situation, I would like the function pointer in Class_C to be able to point to either Class_B_MmbrFnc() or Class_A_MmbrFnc(). (All of the functions I want to point to are going to have the signature of void Function(void), if that makes a difference.) If that's not possible, I would like it to point to Class_A_MmbrFunc(). How can I achieve this? Specifically, what is the syntax for: 1) Declaring the member variable in Class_C to hold the function pointer. 2) Passing the function pointer from Class_B to Class_C. 3) Calling the function using the function pointer. I'm currently looking at the tutorials on-line (which there are several what appear to be good ones), but I'm still having trouble getting it right. Thanks!
class Class_B;
class Class_C;
class Class_A
{
Class_A() {}
~Class_A() {}
void Class_A_MmbrFnc();
Class_B m_objB;
};
class Class_B
{
Class_B() {}
~Class_B() {}
void Class_B_MmbrFnc();
Class_C m_objC;
};
class Class_C
{
Class_C() {}
~Class_C() {}
void Class_C_MmbrFnc();
};