This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Multiple Inheritance Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Multiple Inheritance" Watch "Multiple Inheritance" New topic

Multiple Inheritance

Bala jee
Ranch Hand

Joined: Sep 22, 2007
Posts: 35
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?
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14952

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.

Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
Peter Chase
Ranch Hand

Joined: Oct 30, 2001
Posts: 1970
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?!

Betty Rubble? Well, I would go with Betty... but I'd be thinking of Wilma.
Have you checked out Aspose?
subject: Multiple Inheritance
It's not a secret anymore!