Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Java in General
Search Coderanch
Advance search
Google search
Register / Login
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
Forum:
Java in General
Interface vs Inheritance
Mimmo Ludovico
Ranch Hand
Posts: 49
1
posted 8 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Hi all,
Do inheritance offer better encapsulation than interface? In case of yes, why?
Stephan van Hulst
Saloon Keeper
Posts: 15510
363
posted 8 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Welcome to CodeRanch!
I'm afraid your question doesn't make much sense. Inheritance has nothing to do with encapsulation. Can you be a bit more specific in what you mean?
Mimmo Ludovico
Ranch Hand
Posts: 49
1
posted 8 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Among the techniques to provide the encapsulation is there the use of inheritance? In case of yes I think that my question make sense
Stephan van Hulst
Saloon Keeper
Posts: 15510
363
posted 8 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
No. Inheritance and encapsulation are unrelated features.
Mimmo Ludovico
Ranch Hand
Posts: 49
1
posted 8 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Is "It should be possible to substitute the derived class for its base class" a correct sentence for the inheritance?
Campbell Ritchie
Marshal
Posts: 79177
377
posted 8 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Yes.
Jesper de Jong
Java Cowboy
Posts: 16084
88
I like...
posted 8 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Yes; that's called the
Liskov substitution principle
and it's one of the main principles of inheritance.
Jesper's Blog
-
Pluralsight Author Page
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Getter/Setter vs Private
Enum vs Constant File
subclass vs compostion
Simple Factory vs Factory method
GB vs the USA
More...