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 ofee1
;qq1
is another subtype ofee1
;- you access an instance of both
ww1
andqq1
through the variablerr
, which is of the typeee1
; - you claim that this constitutes multiple inheritance.
Your claim is wrong on several points:
- your example is just about runtime type polymorphism and dynamic method dispatch: accessing different behavior through a common interface;
-
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)