• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Multiple Inheritance

 
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
Ranchers
Can anybody explain that why java does not support multiple inheritance of class in more pratical way
 
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Because of Dimond Problem..

Google "Dimond Problem in java".
 
Ranch Hand
Posts: 169
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
if you have K&B then read about "Deadly Diamond Problem" that migh occur as a result of Multiple Inheritance in Java!!
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Java does not support extending more than one class (at the same level), and that's a good thing. You don't need this when writing software. If you think you do need this, then you should reconsider the design of your software.

Multiple inheritance introduces a number of subtle issues, like the diamond problem that the others are referring to.

The designers of the Java language decided that multiple inheritance is more trouble than it's worth and left it out of Java.

(C++ does support multiple inheritance and the diamond problem is solved there by making it even more complicated - by adding virtual inheritance).
[ June 25, 2007: Message edited by: Jesper Young ]
reply
    Bookmark Topic Watch Topic
  • New Topic