Function Pointer from base class
Posted
by camelord
on Stack Overflow
See other posts from Stack Overflow
or by camelord
Published on 2010-03-22T10:27:11Z
Indexed on
2010/03/22
10:31 UTC
Read the original article
Hit count: 330
c++
Hi there,
i need a Function Pointer from a base class. Here is the code:
class CActionObjectBase
{
...
void AddResultStateErrorMessage( const char* pcMessage , ULONG iResultStateCode);
...
}
CActionObjectCalibration( ): CActionObjectBase()
{
...
m_Calibration = new CCalibration(&CActionObjectBase::AddResultStateErrorMessage);
}
class CCalibration
{
...
CCalibration(void (CActionObjectBase::* AddErrorMessage)(const char*, ULONG ));
...
void (CActionObjectBase::* m_AddErrorMessage)(const char*, ULONG );
}
Inside CCalibration in a Function occurs the Error. I try to call the Function Pointer like this:
if(m_AddErrorMessage)
{
...
m_AddErrorMessage("bla bla", RSC_FILE_ERROR);
}
The Problem is, that I cannot compile. The Error Message says something like: error C2064: Expression is no Function, that takes two Arguments.
What is wrong?
regards camelord
© Stack Overflow or respective owner