My override function never gets called?

A

Angus Comber

Hello

I have a base class a bit like this:

class CTapiCall
{
// Constructor
public:
CTapiCall();
virtual ~CTapiCall();

// Overridable methods for notifications
virtual void OnInfoChange (long InfoState);

// Etc
};


Then I inherit from this class:

class CMainDlg : public CDialogImpl<CMainDlg>, public CTapiCall

In CMainDlg I have this override function:

virtual void OnCallStateIdle ()

In the CTapiCall class I see that OnInfoChange is called. However,
OnCallStateIdle never gets called in my CMainDlg class. What am I doing
wrong?

Angus Comber
(e-mail address removed)
 
J

John Harrison

Angus Comber said:
Hello

I have a base class a bit like this:

class CTapiCall
{
// Constructor
public:
CTapiCall();
virtual ~CTapiCall();

// Overridable methods for notifications
virtual void OnInfoChange (long InfoState);

// Etc
};


Then I inherit from this class:

class CMainDlg : public CDialogImpl<CMainDlg>, public CTapiCall

In CMainDlg I have this override function:

virtual void OnCallStateIdle ()

In the CTapiCall class I see that OnInfoChange is called. However,
OnCallStateIdle never gets called in my CMainDlg class.

Huh? Where did OnCallStateIdle suddenly come from?
What am I doing
wrong?

Very hard to say since you neglected to post either the definition of the
function that isn't being called, or the code that is doing the calling.

I'm not psychic, post again.

john
 
A

Angus Comber

Sorry - Here it is again:

Hello

I have a base class a bit like this:

class CTapiCall
{
// Constructor
public:
CTapiCall();
virtual ~CTapiCall();

// Overridable methods for notifications
virtual void OnInfoChange (long InfoState);

// Etc
};


Then I inherit from this class:

class CMainDlg : public CDialogImpl<CMainDlg>, public CTapiCall

In CMainDlg I have this override function:

virtual void OnInfoChange (long InfoState);

In the CTapiCall class I see that OnInfoChange is called. However,
OnInfoChange never gets called in my CMainDlg class. What am I doing
wrong?

Angus Comber
(e-mail address removed)
 
J

John Harrison

Angus Comber said:
Sorry - Here it is again:

Hello

I have a base class a bit like this:

class CTapiCall
{
// Constructor
public:
CTapiCall();
virtual ~CTapiCall();

// Overridable methods for notifications
virtual void OnInfoChange (long InfoState);

// Etc
};


Then I inherit from this class:

class CMainDlg : public CDialogImpl<CMainDlg>, public CTapiCall

In CMainDlg I have this override function:

virtual void OnInfoChange (long InfoState);

In the CTapiCall class I see that OnInfoChange is called. However,
OnInfoChange never gets called in my CMainDlg class. What am I doing
wrong?

Sorry still don't get it. You are saying that the wrong function is being
called (or maybe no function at all, its not very clear). But you still have
not produced that code that calls the function, all the code you posted is a
few definitions, which doesn't help anyone.

What I want to see is something like this

void CSomeClass::some_function()
{
some_variable->OnInfoChange(123); /* here I want
CMainDlg::OnInfoChange to be called but it calls CTapiClass::OnInfoChange
instead */
}

If its more complex than that (I suspect it is) then I still need to see
*why* you expect CMainDlg::OnInfoChange to be called. You can't just post a
few perfectly valid definitions and say 'what am I doing wrong?'.

john
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top