Win a copy of Practical SVG this week in the HTML/CSS/JavaScript 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.
 
a fool thinks himself to be wise, but a wise man knows himself to be a fool - shakespeare. foolish tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!