L
leaf
How do i 'cast' as a parameter a 'pointer to a member function' of the
class to a function of a member class object of a class?
Here's my example:
//------------------------------------------------------------------------------------------------
class MyClass
{
public:
void OnEvent( LPVOID lpParam );
void SetCallBack( void(__cdecl *fCallBack)(LPVOID lpParam) );
private:
void(__cdecl *m_CallBack)(LPVOID lpParam);
}
void MyClass::SetCallBack( void(__cdecl *fCallBack)(LPVOID lpParam) )
{
m_CallBack = fCallBack;
}
void MyClass::OnEvent( LPVOID lpParam )
{
m_CallBack( lpParam ); // Call the callback function
}
//------------------------------------------------------------------------------------------------
class MyClassMgr
{
public:
static void WINAPI fRealCallBack( LPVOID lpParam );
.....
private;
MyClass m_myclass;
}
// During initialization of MyClassMgr
MyClassMgr::MyClassMgr( )
{
myclass.SetCallBack( &MyClassMgr::fRealCallBack /* ???*/ ) ; //
this part is what i fully understand
}
young_leaf
class to a function of a member class object of a class?
Here's my example:
//------------------------------------------------------------------------------------------------
class MyClass
{
public:
void OnEvent( LPVOID lpParam );
void SetCallBack( void(__cdecl *fCallBack)(LPVOID lpParam) );
private:
void(__cdecl *m_CallBack)(LPVOID lpParam);
}
void MyClass::SetCallBack( void(__cdecl *fCallBack)(LPVOID lpParam) )
{
m_CallBack = fCallBack;
}
void MyClass::OnEvent( LPVOID lpParam )
{
m_CallBack( lpParam ); // Call the callback function
}
//------------------------------------------------------------------------------------------------
class MyClassMgr
{
public:
static void WINAPI fRealCallBack( LPVOID lpParam );
.....
private;
MyClass m_myclass;
}
// During initialization of MyClassMgr
MyClassMgr::MyClassMgr( )
{
myclass.SetCallBack( &MyClassMgr::fRealCallBack /* ???*/ ) ; //
this part is what i fully understand
}
young_leaf