Programming Tutorials Browser Tutorials Articles Struts Tutorials Hibernate Tutorials

  Tutorial: A good explanation

A good explanation

Tutorial Details:

Why not multiple inheritance?
Why not multiple inheritance?
By: By Tony Sintes
Find out why Java's creators prohibited multiple inheritance
July 19, 2002
Why doesn't the Java language support multiple inheritance?
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.
Note: For a discussion of the diamond problem, a classic multiple inheritance challenge, read Bill Venners's " Designing with Interfaces " ( JavaWorld, December 1998) and Tony Sintes's " Java Diamonds Are Forever " ( JavaWorld, March 2001).
Instead, Java's designers chose to allow multiple interface inheritance through the use of interfaces, an idea borrowed from Objective C's protocols. Multiple interface inheritance allows an object to inherit many different method signatures with the caveat that the inheriting object must implement those inherited methods.
Multiple interface inheritance still allows an object to inherit methods and to behave polymorphically on those methods. The inheriting object just doesn't get an implementation free ride. For an excellent discussion of interface inheritance, read Wm. Paul Rogers's " Reveal the Magic Behind Subtype Polymorphism " ( JavaWorld, April 2001).
This page formated for crawlers and browsers that don't support scripts and tables.
Home
EZone


 

Read Tutorial at: Click here to view the tutorial

Rate Tutorial:
A good explanation

View Tutorial:
A good explanation

Related Tutorials:

Signed and delivered: An introduction to security and authentication - JavaWorld - December 1998
Signed and delivered: An introduction to security and authentication - JavaWorld - December 1998
 
Java Tip 39: The trick to using a basic Java 1.1 network and file class loader - JavaWorld -
Java Tip 39: The trick to using a basic Java 1.1 network and file class loader - JavaWorld - October 1997
 
Programming Java threads in the real world, Part 6 - JavaWorld - March 1999
Programming Java threads in the real world, Part 6 - JavaWorld - March 1999
 
An instrumentation network for weather data on the Web
An instrumentation network for weather data on the Web
 
Solve real problems with aglets, a type of mobile agent - JavaWorld May 1997
Solve real problems with aglets, a type of mobile agent - JavaWorld May 1997
 
An introduction to agents - JavaWorld June 1998
An introduction to agents - JavaWorld June 1998
 
Using the if-then-else framework, Part 1 - JavaWorld March 2000
Using the if-then-else framework, Part 1 - JavaWorld March 2000
 
Use Microsoft's Internet Information Server as a Java servlet engine - JavaWorld June 2000
Use Microsoft's Internet Information Server as a Java servlet engine - JavaWorld June 2000
 
Validation with Java and XML Schema, Part 2 - JavaWorld October 2000
Validation with Java and XML Schema, Part 2 - JavaWorld October 2000
 
Robust event logging with Syslog - JavaWorld April 2001
Robust event logging with Syslog - JavaWorld April 2001
 
Master Java with these introductory books - JavaWorld May 2001
Master Java with these introductory books - JavaWorld May 2001
 
Make bad code good - JavaWorld March 2001
Make bad code good - JavaWorld March 2001
 
Test networked code the easy way
Test networked code the easy way
 
A good explanation
A good explanation
 
J2ME app development on the 6600
J2ME app development on the 6600 Introduction When you first look at the Nokia 6600, the first reaction is very predictable. wow! It is truely a good looking phone. A stunner. Let's find out if there's more to this phone than just good looks.
 
Can't beat Jazzy
Introducing the Java platform's Jazzy new spell checker API.
 
JavaServer Pages Technology - Documentation
Sun's tutorial for Java Server Pages that provide a good introduction to design web pages with JSP.
 
Internals of Java Class Loading
When are two classes not the same? When they're loaded by different class loaders. This is just one of many curious side effects of Java's class-loading system. Binildas Christudas shows how different class loaders relate to one another and how (and why)
 
Chat Transcript: Solving the Device Fragmentation Problem
Read the questions that your fellow developers had about the new feature in NetBeans Mobility Pack 4.0 that helps solve device fragmentation problems, and the answers straight from the engineers who created the module.
 
Solaris Patch Management: Recommended Strategy (pdf)
This Sun BluePrints article describes types of patches, patch interrelationships, and patch delivery collections, with recommended practices for maintaining properly patched and updated software. Included is an explanation of what goes into a Solaris soft
 
Site navigation
 

 

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2006. All rights reserved.