• 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: 36
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

Why java does not support multiple inheritence While C++ Supports the same?
What is the drawback Java will face if it supports Multiple in heritance?
 
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 support a form of multiple inheritance; a class can implement more than one interface. But in Java you can't extend multiple classes.

You never really need this in real applications, and it leads to problems like the diamond problem. In C++ this is solved by making things more complicated - you can choose between virtual inheritance and non-virtual inheritance in C++.

One of the goals that the designers of the Java language had was to make it simpler than C++, so they decided to not support multiple inheritance in Java.
 
Ranch Hand
Posts: 1970
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Jesper Young:
One of the goals that the designers of the Java language had was to make it simpler than C++



That's not exactly a difficult goal to achieve is it?!
 
reply
    Bookmark Topic Watch Topic
  • New Topic