Bookmark Topic Watch Topic
  • New Topic

head first java

 
srikanth mycherla
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Report post to moderator
In page 223 of head first java we have the concept of DEADLY DIAMOND OF DEATH .There we can see on class diagram where combodrive class inherits 2 base classes cdburner and dvdburner .

but in java there is no such issue like one derived class inherits two super classes !(multiple inheritance) we can't do it using classes
then how can one support the example of deadly diamond of death

there in pg 223 we can see on question which burn method runs when you call burn () on the combo drive? what does that mean ? when we cant make any combodrive class inherited from cdburner and dvdburner ?
why the question is framed like that when at all we cant inherit a derived class from 2 super classes

please correct me if iam wrong!
 
sanket karkare
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Report post to moderator
srikanth mycherla wrote:In page 223 of head first java we have the concept of DEADLY DIAMOND OF DEATH .There we can see on class diagram where combodrive class inherits 2 base classes cdburner and dvdburner .

but in java there is no such issue like one derived class inherits two super classes !(multiple inheritance) we can't do it using classes
then how can one support the example of deadly diamond of death

there in pg 223 we can see on question which burn method runs when you call burn () on the combo drive? what does that mean ? when we cant make any combodrive class inherited from cdburner and dvdburner ?
why the question is framed like that when at all we cant inherit a derived class from 2 super classes

please correct me if iam wrong!


Above the figure, it is clearly mentioned that Multiple inheritance is a bad thing and is not possible in java.
Read the text above the class diagram again
 
Henry Wong
author
Marshal
Pie
Posts: 21496
84
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Report post to moderator

This forum is for book reviews !! In the future, please post topics in the correct forum.

Since this topic has been answered, I will just lock it, instead of moving it.

Henry
 
Don't get me started about those stupid light bulbs.
    Bookmark Topic Watch Topic
  • New Topic