aspose file tools
The moose likes Java in General and the fly likes acheive multiple inheritance... Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "acheive multiple inheritance..." Watch "acheive multiple inheritance..." New topic
Author

acheive multiple inheritance...

Vinney Shanmugam
Ranch Hand

Joined: Aug 27, 2008
Posts: 104
How to acheive multiple inheritance in java other than using interfaces?
I was asked this question once and answer i thought was the below one, Just tell me whatever i stated is okay or is there any other way to do this?

abstract class a {}
abstaract class b extends a {}
class concrete extends b{
should have implementation of methods available at both abstract class a and b.
}
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 16692
    
  19

But that is *not* how multiple inheritance is defined... Multiple inheritance is the ability to inherit from many unrelated classes. Think of it as the ability to inherit implementations from two different services, from two different sources, that know nothing of each other. Obviously, if they are sub/super classes of each other, they do know something of each other.

Short answer... you can't. Java doesn't support real multiple inheritance, even with interfaces.

Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: acheive multiple inheritance...
 
Similar Threads
super class, class
Abstract Classes Vs Interfaces
Object Class is father of all??
Abstract, Interfaces!
Does JAVA support multiple inheritance or not