Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Query on implementation inheritance

 
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have been reading java interview questions and read the following about implementation inheritance.


"When using implementation inheritance, make sure that the sub-classes depend only
on the behavior of the superclass, not on the actual implementation."

Am confused about what the above statement means?
 
Bartender
Posts: 10777
71
Hibernate Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Rajiv Rai wrote:Am confused about what the above statement means?


Basically, what it means is that you shouldn't rely on a method having a particular implementation when you call it. And I'd go further and say that the statement applies whether you're using interface inheritance or not.

When tutorials refer to 'behaviour', they usually mean methods; when they talk about 'implementation', they're referring to code. You can call a method without having to know the code it contains.

Winston
 
We should throw him a surprise party. It will cheer him up. We can use this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic