• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Devaka Cooray
  • Ron McLeod
  • paul wheaton
Saloon Keepers:
  • Tim Moores
  • Piet Souris
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Frits Walraven
  • Scott Selikoff

acheive multiple inheritance...

 
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
}
 
author
Posts: 23928
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Once upon a time there were three bears. And they were visted by a golden haired tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic