Click here to Skip to main content
15,888,527 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionHooking Pin
S p k 5215-Jan-10 0:50
S p k 5215-Jan-10 0:50 
Questionc++ Pin
surekha.btech5-Jan-10 0:15
surekha.btech5-Jan-10 0:15 
AnswerRe: c++ Pin
«_Superman_»5-Jan-10 0:28
professional«_Superman_»5-Jan-10 0:28 
AnswerRe: c++ Pin
CPallini5-Jan-10 0:28
mveCPallini5-Jan-10 0:28 
AnswerRe: c++ Pin
bilal haider5-Jan-10 0:56
bilal haider5-Jan-10 0:56 
AnswerRe: c++ Pin
Richard MacCutchan5-Jan-10 1:15
mveRichard MacCutchan5-Jan-10 1:15 
AnswerRe: c++ Pin
Hamid_RT5-Jan-10 3:17
Hamid_RT5-Jan-10 3:17 
QuestionDerived Class Function Pointer Error Pin
J Forde5-Jan-10 0:11
professionalJ Forde5-Jan-10 0:11 
Hi
I'm getting the following error during compilation:

error C2440: '=' : cannot convert from 'void (__thiscall CCBEMFGUILayer::*)(const char *)' to 'void (__thiscall CCBEMFLayer::*)(const char *)'

on the line: pMFPostMessage = MFPostMessage; // see below

CCBEMFGUILayer::CCBEMFGUILayer()
{
sLayerSignature = "<SourceLayer Name=\"GUI\"";
pMFPostMessage = MFPostMessage;
}

CCBEMFGUILayer::~CCBEMFGUILayer()
{

}

string CCBEMFGUILayer::GetLayerSignature()
{
return sLayerSignature;
}

void CCBEMFGUILayer::MFPostMessage( const char *cGUIMessage )
{

string sRecvMessage;

sRecvMessage = (string)cGUIMessage;

return;
}


MFGUILayer inherits from MFLayer.

class CCBEMFLayer
{
public:
CCBEMFLayer();
virtual ~CCBEMFLayer();
virtual void MFPostMessage( const char * );
virtual string GetLayerSignature();
void (CCBEMFLayer::*pMFPostMessage)( const char * );

};

class CCBEMFGUILayer : public CCBEMFLayer
{
public:
CCBEMFGUILayer();
virtual ~CCBEMFGUILayer();
string GetLayerSignature();
void MFPostMessage( const char * );

protected:
string sLayerSignature;
};


MFGUILayer implements MFPostMessage and I want to store a pointer to this function so I can add it to a subscriber class and then call the appropriate function based on a message signature.

How do I cast this correctly (if at all)?

Any help or direction appreciated.

Jim
QuestionRe: Derived Class Function Pointer Error Pin
CPallini5-Jan-10 0:24
mveCPallini5-Jan-10 0:24 
AnswerRe: Derived Class Function Pointer Error Pin
J Forde5-Jan-10 4:39
professionalJ Forde5-Jan-10 4:39 
Questionhelp me please! Pin
nenfa4-Jan-10 22:23
nenfa4-Jan-10 22:23 
AnswerRe: help me please! Pin
KingsGambit4-Jan-10 23:35
KingsGambit4-Jan-10 23:35 
GeneralRe: help me please! Pin
nenfa4-Jan-10 23:48
nenfa4-Jan-10 23:48 
AnswerRe: help me please! Pin
David Crow5-Jan-10 3:30
David Crow5-Jan-10 3:30 
Question_variant_t conversion Pin
MsmVc4-Jan-10 22:10
MsmVc4-Jan-10 22:10 
QuestionRe: _variant_t conversion Pin
CPallini4-Jan-10 22:19
mveCPallini4-Jan-10 22:19 
AnswerRe: _variant_t conversion Pin
MsmVc4-Jan-10 22:30
MsmVc4-Jan-10 22:30 
QuestionRe: _variant_t conversion Pin
CPallini4-Jan-10 22:54
mveCPallini4-Jan-10 22:54 
AnswerRe: _variant_t conversion Pin
Madhu Nair4-Jan-10 23:33
Madhu Nair4-Jan-10 23:33 
QuestionRe: _variant_t conversion Pin
KingsGambit4-Jan-10 22:19
KingsGambit4-Jan-10 22:19 
QuestionCustomize EditBox Pin
kumar sanghvi4-Jan-10 21:55
kumar sanghvi4-Jan-10 21:55 
AnswerRe: Customize EditBox Pin
Nelek4-Jan-10 22:07
protectorNelek4-Jan-10 22:07 
QuestionGlobal variables Pin
Pryabu4-Jan-10 19:45
Pryabu4-Jan-10 19:45 
AnswerRe: Global variables Pin
SandipG 4-Jan-10 20:07
SandipG 4-Jan-10 20:07 
AnswerRe: Global variables Pin
KingsGambit4-Jan-10 20:08
KingsGambit4-Jan-10 20:08 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.