Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Multi level inheritance.

 
Mushtaq Ahmed
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
why does java does'nt allow multilevel inheriance .
 
Faisal Khan
Ranch Hand
Posts: 285
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Multiple inheritance can be a serious mess and has been a point of contention in the C++ world, therefore Java has removed the notion of multiple inheritance.
However, you can implement multiple interfaces.
 
Jeremy Thornton
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you mean multiple inheritance?
If so, preventing multiple inheritance avoids many of the associated problems such as where D extends B and C both of which extend A. If you call a method on D which is implemented in B and C, which implementation do you choose?
Multi level inheritance (e.g. C extends B extends A) is allowed.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic