Abstract class and Multiple Inheritance errors??

Discussion in 'C++' started by santosh, Jan 5, 2005.

  1. santosh

    santosh Guest

    Hi All ,
    I got it working.. The problem was simple replacement of virtual
    keyword to different place.

    Below code works fine..

    class Interface
    {
    public:
    virtual void funA() = 0;
    virtual void funB() = 0;
    virtual void funD() = 0;
    Interface();
    ~Interface();
    };

    class A : virtual public Interface
    {
    public:
    A();
    ~A();
    void funA()
    {
    printf("A::funA");
    }
    };

    class B : virtual public Interface
    {
    public:
    B();
    ~B();
    void funB()
    {
    printf("B::funB");
    }
    };

    class D: public A , public B
    {
    public:
    D();
    ~D();
    void funD()
    {
    printf("D::funD");
    }
    };

    int _tmain(int argc, _TCHAR* argv[])
    {
    D *d;
    d = new D;

    return 0;
    }

    Thanks
    -Sanotsh
    //AbstractInterface
    santosh, Jan 5, 2005
    #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. Matthias Kaeppler
    Replies:
    1
    Views:
    417
    R.F. Pels
    May 22, 2005
  2. Sameer
    Replies:
    4
    Views:
    572
    Roedy Green
    Aug 31, 2005
  3. santosh
    Replies:
    3
    Views:
    5,373
    Mike Hewson
    Jan 5, 2005
  4. Uzytkownik
    Replies:
    3
    Views:
    577
    Uzytkownik
    Apr 3, 2005
  5. Replies:
    4
    Views:
    800
    Rolf Magnus
    May 17, 2006
Loading...

Share This Page