![]() |
|
#1
|
||||
|
||||
Multiple Inheritence In Java ... ?Need Some Knolwedge About Java as I am New To Java And Reading Books But Need Its Explaination In Clear Words Not Technichal WOrds.
Q :: Why Multiple Inheritence Is not possible in Java . Give a Brief explanantion please as Soon as Possible. REGARDS |
||||
|
#2
|
||||
|
||||
Re: Multiple Inheritence In Java ... ?Because with multiple inheritance, there is a problem that arises called the diamond of death. This occurs if a class inherits from multiple classes. All the methods of that class are copied into the class that inherits them. If both superclasses had methods with the same name and parameters, which one would be used? multiple inheritance often produces ambiguous, unclear results. Because of this, java does not allow multiple inheritance.
|
|
#3
|
|||
|
|||
Re: Multiple Inheritence In Java ... ?but you can implement multiple interfaces in java. Here since the methods are all abstract and thus has no method body, you are free to add your own method body.thus 'diamond of death' will never occur.
|
|
#4
|
|||
|
|||
Re: Multiple Inheritence In Java ... ?and you can also chain objects together with inheritance.
example: i am making a tower defense game for a class at the moment. any basic object of a game is an Entity, my tower, creep, and bullet base classes extend Entity, the different styles of towers creeps and bullets extend their respective base classes. so a basicTower is a Tower which is an Entity. so basicTower has all of the functionality of an Entity |
Recent GIDBlog
Problems with the Navy (Enlisted) by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Error C2374 | lolp1 | C++ Forum | 3 | 25-May-2008 16:40 |
| To post messages / click Buttons of a Java Jar App using code | Jun0 | C Programming Language | 1 | 06-Jan-2007 14:44 |
| To post messages / click Buttons of a Java Jar App using code | Jun0 | Java Forum | 0 | 06-Jan-2007 11:14 |
| Scalability in Java and C++ | agx | Miscellaneous Programming Forum | 7 | 04-Feb-2006 15:35 |
| Linker errors with multiple file progam | nkhambal | C Programming Language | 2 | 24-Apr-2005 02:37 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The