• Post Reply Bookmark Topic Watch Topic
  • New Topic

how java avoid multiple inheritance  RSS feed

 
venkata charan
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
by which technique java avoid multiple inheritance
as per specification java does not allow multiple inheritance
what is the perfect technique to achieve this process
Thanks and Regards
Charan
 
Jeroen T Wenting
Ranch Hand
Posts: 1847
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
having the compiler reject any attempt to do it
 
Tony Morris
Ranch Hand
Posts: 1608
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is possible to write an entire API Specification without using multiple inheritance or even inheritance at all.

http://contractualj.com/

All classes are declared final. Concrete behaviour inheritance is not permitted.

It is even possible to avoid contract/interface inheritance, since these types in Java are static (implying some knowledge about the future as does any static inheritance). However, this has drawbacks as opposed to avoiding concrete behaviour inheritance where the cost/benefit is to an extreme (read: infinity) such that it should always be avoided.
Benefit > 0
Cost == 0
x/0 == infinity - for all x > 0

The "techniques" for doing so have been described in many ways over the years. I prefer something like "as accurate as possible, a specification of requirement for the software, conceding to the fact that one must fall infinitely short of a complete specification - implied by the tools at hand" - which contains an awful paradox within if you look close enough.
 
Jeroen T Wenting
Ranch Hand
Posts: 1847
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's even possible to write an entire programming language without inheritance...
Pascal, Cobol, C, Progress, Assembler, Fortran, etc. etc.
 
Jeff Albertson
Ranch Hand
Posts: 1780
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's also possible to write a program using entirely Whitespace. (I used to think this language consisted entirely of whitespace characters, but now I see non-whitespace characters are simply ignored.)
 
Tony Morris
Ranch Hand
Posts: 1608
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sure, however, I am restricting my context to Java in my comments above. I agree - the possibilities are awesome if you abandon this context
 
Ken Blair
Ranch Hand
Posts: 1078
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Tony Morris:
The "techniques" for doing so have been described in many ways over the years. I prefer something like "as accurate as possible, a specification of requirement for the software, conceding to the fact that one must fall infinitely short of a complete specification - implied by the tools at hand" - which contains an awful paradox within if you look close enough.


Long winded way of saying "Do they best you can with what you've got" isn't it?
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!