Logo 
Search:

Java Answers

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds
  Question Asked By: Clifton Flores   on Apr 29 In Java Category.

  
Question Answered By: Cais Nguyen   on Apr 29

No - C extends B. B extends A. This is a single inheritance
hierarchy. Java only supports single inheritance.

Multiple inheritance  is where a class  inherits from two (or more)
classes from different hierarchies. A popular example is a pencil
with an eraser - if multiple  inheritance was available the qustion
was should you create a new class that inherits from both Class
Pencil and Class Eraser. The answer is that a pencil with an eraser
on the end is a subclass of pencil that 'has a' eraser.

Multiple-inheritance has been deprecated in OO circles for a long
time. In Java you can use interfaces i.e a pencil that has an eraser
would implement both the pencil and eraser interface.

Share: 

 

This Question has 12 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on Multiple Inheritance Or get search suggestion and latest updates.


Tagged: