Encapsulation is just hiding the internal mechanism of the program
Abstraction is providing a public interface from encapsulated program
is that true ??
|
That's a little hard for me to tell without the context, but it sounds like encapsulation to me, as abstract methods have no data to hide. |
|
|
Hi i have some confusion related to these terms...please have a look if i am correct or not:- Abstraction means- hiding implementation. encapsulation means-hiding data. Is above definitions are correct.If yes How these two terms are related? I mean can these things exist without each other? Thanks in advance to go through this post.. |
|
To tie List back the the definition I gave, you can (usually) ignore how a List is implemented and focus on what it promises to do for you. public void myMethod( List input ) { do something with input } There are levels of abstraction. That method is at a high level because it doesn't care at all what kind of ... |
|
|
Abstraction is about leaving out details that don't matter in the current conversation so you can focus on other details that do matter. For example a method that takes a List parameter cares about the behavior that is promised by the List interface, but doesn't care whether it's an ArrayList or LinkedList or some other implementation. So we call List an ... |
hi! It is said that u really cannot draw a boundary between abstraction & encapsulation. As per the definition abstraction is selective acceptance. That is u try to find out important properties/behaviour of an real world entity. and keep them as part of ur class to get an object in software domain. that is class attributes & class methods.U keep them ... |
Hi, Abstraction simply means hiding the details of something. Encapsulation means binding the member variables and methods in a template called class. Now you have a encapsulated class. To achieve the abstraction you make the member variables private and allow accessibility only through methods (not directly) that are made public. The benefit of this abstraction is that, you are only providing ... |
The best way to learn is to do some research, then come here with specific questions. There are tons of resources, both print and online. try finding the answer yourself first, and when you get stuck or confused, ask about that. or, if you think you know the answer, post it, and say "is this right?" You'll learn much more that ... |
Abstraction: For example, A 'Person' is not an 'Animal'. We can prove it by abstraction. Drawing a line and Defining an Object's Property and Behaviour is Abstraction. Encapsulation: After drawing a line and defining the properties and behaviour, now Hidding internal details of particular behaviour and hidding certain properties is encapsulation. Example: if you kick a dog he bites. This is ... |
Wraping up of data and functions is called data encapsulation ! Agreed ! so a class is encapsulated! Abstraction refers to act of representing essential features without showing the details of implementation. What do you call this as ? Abstract class/ Interface Methods Classes again or what it is actually ? Even in a class, as per my understanding, we can ... |
|
|
pankaj vijay wrote: i am very confused between Encapsulation & Abstraction & Data Hiding.... they all seems like same... as per my knowledge encapsulation means containing many thing like fields members in an object is encapsulation Hiding inner working form user is abstraction. while not showing field to the user is Data Hiding... but am i right??? When you ... |
Abstraction is to hide/reduce implementation detail. The use of an interface is an example. You know how to use it but you don't know the implementation details. Another example is the iterator pattern. With that pattern you can hide the data-structure without compromising it's accessibility. Encapsulation is the process in which internal variables are hidden and made accessible by certain methods. ... |
Encapsulation has to do with hiding the details of an object from the public. In order words, hiding the inner workings. A radio is filled with circuits and wires and resistors. The user of the radio does not see any of that. To the user, they only see the interface (The buttons and dials, and knobs). What happens inside the radio ... |
|
|
hello to all can any one explain me in detail with real world example as well as with the help of program the difference between data abstraction and data encapsulation. and make me right if i m wrong: according to me data encapsulation is data hiding and data abstraction is providing the essential details of an object by ignoring the irrelevant ... |
|
Abstraction refers to the act of representing essential features without including the background details or explanations but encapsulation is a technique used for hiding the properties and behaviors of an object and allowing outside access only as appropriate and also prevents other objects from directly altering or accessing the properties or methods of the encapsulated object. |
Hello friends, We always hear that abstraction and encapsulation concepts are two properties of object oriented programming languages, but if we talk about C, then a function is able to hide complexity. Is this not abstraction? We just need function's name to use it and not the implementation details. About encapsulation I am more sure that it is not in procedural ... |
|
|
|
That's the ironic thing about these interview questions. The people who know the answers have heard the question so many times that it's pure annoyance. The only people who find the question interesting are the ones who are at about the same level of understanding as the OP, which means the answers tend to be useless, if not dead wrong. (Or, ... |
|