Original Post
Analyze:
I could declare AFunc to take a pointer to a member function of B, but I don't want A to be dependant on B, in case I want to use A in another class.
Does anyone know how to go around this? I don't think static member function would work neither. Thanks.
[edited by - vbisme on May 27, 2003 4:14:30 PM]
class A
{
public:
long AFunc(void(*pfn)(void))
{
//Do something
}
};
long MyFunc();
void main()
{
A MyA;
MyA.AFunc(&MyFunc); //This is ok
}
long MyFunc()
{
//Do something
}
As could see, the above is legitimate. However,
//Assume class A is defined
class B
{
protected:
A m_MyA;
public:
void BFunc()
{
m_MyA.AFunc(BFunc2); //Illegal
}
long BFunc2()
{
//Do something
}
};