• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Multiple Inheritence

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am an absolute beginner in Java but hava a fairly good C++ background.
Is this statement true? If so, please explain.
'Java supports multiple inheritence indirectly through interfaces'.
Regards,
Vidyut
 
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Vidyut!
Yes java supports multiple inheritence indirectly through interfaces.
The basic idea of multiple inheritence is to implement the properties of the base class.Here in java we do it through interfaces with the help of "implements" keyword.
Hope u find this information useful.
Regards
Preethi
 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi ,
Comparing with C++, Java facilitates using features of multiple classes in a child class with interfaces. Interfaces are the one which have "What to do...." in them but not "how to do..."
This might give you a start in understanding interfaces in Java
 
Sheriff
Posts: 9109
12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Kiran,
Please see this page and register properly. Thanks.
 
vidyut chavan
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What I am trying to understand, is how technically correct
is that statement. Meaning, do interfaces in Java map the
'Multiple Inheritance' concept literally?
Let me try to explain more clearly in terms of the actual definition
of 'Multiple Inheritance'.....
Multiple Inheritance, as I understand, is the ability of a language to allow 'Subclassing' and 'Subtyping'.
Subclassing, is basically allowing child classes to 'use'
methods and possibly variables from another class.
The implementation is unimportant, as long as the user may reuse code.
Sybtyping is the ability for a data type (usually a class) to derive its type from another data type.
C++ provides both these.
Java provides 'Subtyping' through 'interfaces',
but NOT the 'Subclassing', so would one say that Java allows 'Multiple Inheritance'?
To me the more correct statement would be, that
'Java provides for multiple inheritance, only partly through interfaces'.
Sorry to be so nit-pickity on the definitions, but I though this was essential, since none of the answers I got were of much help. I was and am not asking anyone to explain interfaces, its the concept of multiple inheritance in Java that I was wishing an explanation for. I do hope, someone can give me a more satisfying answer to this question
Regards,
Vidyut

 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic