A
Ant
Hi,
I am having trouble with a member function pointer. It sees to give me the
followign error
Run-Time Check Failure #0 - The value of ESP was not properly saved across a
function call.
It only seems to give me problems if I use the friend class declaration
Any thoughs ?
Code Follows:
#include "rootclass.h"
int _tmain(int argc, _TCHAR* argv[])
{
CRootClass *testclass;
testclass = new CRootClass;
testclass->TestFunction();
delete testclass;
return 0;
}
class CStore
{
public:
CStore(void);
~CStore(void);
friend class CRootClass;
typedef void(CRootClass::*FunctionPtr)(void);
void PassPtr(FunctionPtr FPtr);
};
#include ".\store.h"
CStore::CStore(void)
{
}
CStore::~CStore(void)
{
}
void CStore:assPtr(FunctionPtr FPtr)
{
//something happens with ptr
}
#include ".\store.h"
class CRootClass
{
public:
CRootClass(void);
~CRootClass(void);
CStore *m_Store;
void TestFunction(void);
};
#include ".\rootclass.h"
CRootClass::CRootClass(void)
{
m_Store = new CStore();
m_Store->PassPtr(&CRootClass::TestFunction );
}
CRootClass::~CRootClass(void)
{
delete m_Store;
}
void CRootClass::TestFunction(void)
{
//some code
}
I am having trouble with a member function pointer. It sees to give me the
followign error
Run-Time Check Failure #0 - The value of ESP was not properly saved across a
function call.
It only seems to give me problems if I use the friend class declaration
Any thoughs ?
Code Follows:
#include "rootclass.h"
int _tmain(int argc, _TCHAR* argv[])
{
CRootClass *testclass;
testclass = new CRootClass;
testclass->TestFunction();
delete testclass;
return 0;
}
class CStore
{
public:
CStore(void);
~CStore(void);
friend class CRootClass;
typedef void(CRootClass::*FunctionPtr)(void);
void PassPtr(FunctionPtr FPtr);
};
#include ".\store.h"
CStore::CStore(void)
{
}
CStore::~CStore(void)
{
}
void CStore:assPtr(FunctionPtr FPtr)
{
//something happens with ptr
}
#include ".\store.h"
class CRootClass
{
public:
CRootClass(void);
~CRootClass(void);
CStore *m_Store;
void TestFunction(void);
};
#include ".\rootclass.h"
CRootClass::CRootClass(void)
{
m_Store = new CStore();
m_Store->PassPtr(&CRootClass::TestFunction );
}
CRootClass::~CRootClass(void)
{
delete m_Store;
}
void CRootClass::TestFunction(void)
{
//some code
}