Sunday, 23 October 2016

Multiple inheritance

Multiple inheritance

  • A class is derived from multiple super classes is called Multiple inheritance
  • Java does not support multilevel inheritance.
Why not support?

  • Just assuming, class A,B,C.
  • class A is parent class to B.
  • class B is parent class to C.
  • So, here is C is the child class of both A and B classes.
  • Hope you got clear about points, otherwise please read.
  • Then here again assuming A class holds x = 10 value and B class also holds the value with same name of x = 20.
  • Then C class will get ambiguity while getting this variable.
  • This concept is not only applicable to variable, it will applicable for methods also.
  • So, because of above reason java will not support multiple inheritance. 

Thanks for your time.
Nireekshan