My override function never gets called?

Discussion in 'C++' started by Angus Comber, Apr 10, 2004.

  1. Angus Comber

    Angus Comber Guest

    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
     
    Angus Comber, Apr 10, 2004
    #1
    1. Advertising

  2. "Angus Comber" <> wrote in message
    news:4077e762$0$11661$...
    > 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
     
    John Harrison, Apr 10, 2004
    #2
    1. Advertising

  3. Angus Comber

    Angus Comber Guest

    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
     
    Angus Comber, Apr 10, 2004
    #3
  4. "Angus Comber" <> wrote in message
    news:4077e9b4$0$95317$...
    > 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
     
    John Harrison, Apr 10, 2004
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Will

    Host never gets my certificate?

    Will, Nov 19, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    324
  2. Soren Kuula
    Replies:
    1
    Views:
    452
    Henry S. Thompson
    Dec 1, 2005
  3. Angus Comber
    Replies:
    3
    Views:
    884
    John Harrison
    Apr 11, 2004
  4. Kevin
    Replies:
    4
    Views:
    428
    Irrwahn Grausewitz
    Oct 17, 2003
  5. k3xji
    Replies:
    0
    Views:
    285
    k3xji
    Apr 17, 2009
Loading...

Share This Page