• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Multiple inheritance (was: Raghavendra)

 
raghava rao
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How to achive Multiple Inheritance in Java?

[ EJFH: Added a sensible title ]
[ December 08, 2004: Message edited by: Ernest Friedman-Hill ]
 
Jimmy Die
Ranch Hand
Posts: 97
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,


Multiple inheritance is not possible, as classes can extend only 1 other class. Extending a class is defined as inheritance. You can implement multiple interfaces, but interfaces is not a class.
 
Jeroen Wenting
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
interesting topic, how does it relate to the question?
 
raghava rao
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jimmy,
In java, we canot create a class by extending two classes..
Java doesnot support multiple inheritance.

but , what my question is .. is there any way to achive this same concept using interface or something else?

Thanks in advance

Raghav
 
Jeroen Wenting
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes and no.

You can implement multiple interfaces but you can not share implementation details with more than one class as interfaces don't contain implementation details.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic