overloaded functions in multiple inheritance.

Discussion in 'C++' started by DX, Jun 11, 2004.

  1. DX

    DX Guest

    in MSVC7 the following seems to work:

    class A { public: virtual void func1(void); };
    class B { public: virtual void func2(void); };

    class AB : public A, public B
    {
    virtual void A::func1(void) {return 0;};
    virtual void B::func1(void) {return 1;};
    }

    This is great, except my two versions of func1 are actually huge, and
    I'd like to put them into two separate files. In order to do this,
    I'm doing something like:

    class AB : public A, public B
    {
    virtual void A::func1(void);
    virtual void B::func1(void);
    }

    void AB::A::func1(void)
    { return 0; };

    void AB::A::func1(void)
    { return 1; };

    However, when I do this, I get a compiler error:
    error C2509: 'func1': member function not declared in 'AB'

    Anyone have any clue what I'm doing wrong? Syntax error somewhere?
     
    DX, Jun 11, 2004
    #1
    1. Advertisements

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. DX
    Replies:
    3
    Views:
    432
  2. Joe P
    Replies:
    1
    Views:
    342
    Pete Becker
    Jun 21, 2005
  3. Replies:
    8
    Views:
    417
  4. jrraines

    overloaded name + inheritance

    jrraines, Mar 20, 2010, in forum: C++
    Replies:
    1
    Views:
    502
    Michael Tsang
    Mar 22, 2010
  5. John Wickerbee

    Inheritance of overloaded ++ operator issue

    John Wickerbee, Oct 2, 2011, in forum: C Programming
    Replies:
    1
    Views:
    578
    Ahmed Al_gohary
    Apr 4, 2015
Loading...

Share This Page