• Post Reply Bookmark Topic Watch Topic
  • New Topic

why java does not have multiple inheritance?  RSS feed

 
senthil sen
Ranch Hand
Posts: 184
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
why java does not have multiple inheritance?
why java is not a 100% oops?
what is a resource bundle?
 
girish rateshwar
Ranch Hand
Posts: 99
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi once again,
Why java does not support multiple inheritance???
well i guess people at Sun microsystems may b in a better position to answer this.
But http://www.javaworld.com/javaqa/2002-07/02-qa-0719-multinheritance.html is the place where i think u can look for the info.
Pertaining the resource bundle:belonging to the util package.
resource bundles allows the user to use locale specific resource, i mean u can create a program which can be run in diff languages using locales.
For instance an applet containing a button (Thank you) for a site in english :: the same applet can be run on a site in german(Danke).
So in this way u can cerate diff resource bundles for many different locales.
Well i hope it helps.
Regards,
 
Cindy Glass
"The Hood"
Sheriff
Posts: 8521
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In c++ the number one cause of bugs is the use of pointers. The second major cause of bugs is multiple inheritance. When Java was developed they wanted to avoid things that cause alot of bugs. Having multiple interfaces can give you as much flexibility and power, it is just a matter of learning to think a bit differently.
Objects cause alot of overhead. In the interest of optimization it was decided to create primitives that are NOT objects. They are the major reason why Java is not considered to be completely Object Oriented. Please note that c++ is also not completely OO, and Visual Basic is not OO hardly at all.
 
James Chegwidden
Author
Ranch Hand
Posts: 201
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

and Visual Basic is not OO hardly at all.

more so with VB .net than VB 6
 
Matt O'Toole
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Don't interfaces do pretty much the same thing as multiple inheritance?
 
Greg Brouelette
Ranch Hand
Posts: 144
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
>Don't interfaces do pretty much the same thing as multiple inheritance?
Multiple inheiritence would mean that each of the parent classes has functional code in it already. An interface is more like what we would call (in C++) a "pure abstract class". That is, a class with method declarations but no functional code.
The problem with multiple inheiritence comes from ambiguity. Assume that Class A and Class B both have a foo method and that this method is implemented differently in each of these classes. Class C is derived from both Class A and Class B (in a language that supports multiple inheiritence).
Now, in Class C you call the foo method. Which one does it call? The one it inheirited from Class A or from Class B? Therein lies the problem.
With an interface it simply says "Anything that implements me must have these methods", but the actual implementation is in the child class. So there's no ambiguity.
I thought it was quite interesting that Bjarne Stroustrup, the author of "The C++ Language", said that if he had it to do over again he would have left multiple inheiritence out of C++. He felt that it caused more problems than it solved.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!