[Solved] is this Multiple Inheritance? (JAVA)


Just to straighten out your claim, you wrote

        ww1 ob=new ww1();
        qq1 ob1=new qq1();
        ee1 rr;
        rr=ob;
        rr.s();
        rr=ob1;
        ob1.s();

In words,

  • ww1 is a subtype of ee1;
  • qq1 is another subtype of ee1;
  • you access an instance of both ww1 and qq1 through the variable rr, which is of the type ee1;
  • you claim that this constitutes multiple inheritance.

Your claim is wrong on several points:

  1. your example is just about runtime type polymorphism and dynamic method dispatch: accessing different behavior through a common interface;
  2. the only way I can interpret the term multiple inheritance to make sense for your question would be “a type can have multiple children which inherit from it”. This is:

    a) true for Java and all other languages which have class hierarchy;

    b) a wrong interpretation of the term “multiple inheritance”, which pertains to cases where a class may have two parent classes.

I hope I am guessing correctly what your actual question is about.

solved is this Multiple Inheritance? (JAVA)