-
Junior Member
Re: Java
In C++ there was concept of multiple inheritance,but threre was some ambiguity in the method names,if two classes have same method name then it was difficult to know which method is being called ,if class inherriting both of those classes.
So to reduce compexity and ambiguity java supports only single inheritence,however it can inherit multiple interfaces.
-
Contributing Member
Re: Java
Whenever you find yourself asking why Java has or does not have some feature, consider the design goals behind the Java language. With that in mind, I started my search by skimming through "The Java Language Environment" by James Gosling and Henry McGilton (Sun Microsystems), a white paper published in May 1996 that explains some of the reasoning behind Java's design.
As the white paper states, the Java design team strove to make Java:
* Simple, object oriented, and familiar
* Robust and secure
* Architecture neutral and portable
* High performance
* Interpreted, threaded, and dynamic
The reasons for omitting multiple inheritance from the Java language mostly stem from the "simple, object oriented, and familiar" goal. As a simple language, Java's creators wanted a language that most developers could grasp without extensive training. To that end, they worked to make the language as similar to C++ as possible (familiar) without carrying over C++'s unnecessary complexity (simple).
In the designers' opinion, multiple inheritance causes more problems and confusion than it solves. So they cut multiple inheritance from the language (just as they cut operator overloading). The designers' extensive C++ experience taught them that multiple inheritance just wasn't worth the headache.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules