Forums Register Login

Query on implementation inheritance

+Pie Number of slices to send: Send
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?
+Pie Number of slices to send: Send
 

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
You don't like waffles? Well, do you like this tiny ad?
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 683 times.
Similar Threads
MultipleImplementation Inheritance using Inner Class
MULTIPLE IMPLEMENTATION INHERITANCE
OOConcepts
Difficulty in Java 1.5
Realization/Generalization?
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 11:40:37.