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

    overloaded name + inheritance

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

    Inheritance of overloaded ++ operator issue

    John Wickerbee, Oct 2, 2011, in forum: C Programming
    Replies:
    0
    Views:
    410
    John Wickerbee
    Oct 2, 2011
Loading...

Share This Page