What is the difference between the Encapsulation and
Abstraction
Answers were Sorted based on User's Feedback
Answer / rohini
Encapsulation means we hide the data from directly
interaction and Abstraction means
we bother about what the object can do but don't bother
about how it does?
Is This Answer Correct ? | 78 Yes | 19 No |
Answer / k.ramaswamy
Encapsulation means we are hiding the code and data in to a
single unit to protect the data from outside world.
Abstraction means we know about the object how it can be
used but we dont know how it is implemented. and we can
hide the data using the AccessSpecifiers.
Is This Answer Correct ? | 56 Yes | 12 No |
Answer / amrut
Encapsulation is nothing but showing only those things
which are required by wrapping up complexity & hence it is
also called that it leads to data hiding but its not data
hiding. Never say its data hiding… its wrapping up
complexity in one capsule that is class & hence
Encapsulation…
While abstraction denotes the essential characteristics of
an object which differentiates from other kinds of object...
Abstraction is achieved by making class abstract having one
or more methods abstract. Which is nothing but essential
characteristic which should be implemented by the class
extending it.
e.g. when you inventing/designing a car you define a
characteristics like car should have 4 doors, break,
steering wheel etc… so anyone uses this design should
include this characteristics. Implementation is not the
head each of abstraction. It will just define
characteristics which should be included.
Encapsulation is achieved keeping data and the behaviour in
one capsule that is class & by making use of access
modifiers like public, private, protected along with
inheritance, aggregation or composition. So you only show
only required things, that too, only to the extent you want
to show. i.e. public, protected, friendly & private...
e.g. GM decides to use the abstracted design of car above.
But they have various products having the same
characteristics & doing almost same functionality. So they
write a class which extends the above abstract class. It
says how gear box should work, how break should work, how
steering wheel should work. Then all the products just use
this common functionality. They need not know how the gear
box works or break works or steering wheal works.
Indivisual product can surely have more features like a/c
or auto lock etc…..
Is This Answer Correct ? | 17 Yes | 1 No |
Answer / arunkumar
Encapsulation means combine the data and its associated
methods.By using encapsulation we can hide the data from
outside of class.
Abstraction means it hides the unnecessary data and it shows
the essential data
Is This Answer Correct ? | 13 Yes | 2 No |
Answer / thirumalesh
Encapsulation is process of binding data into single unit
which hides the implementation for an objects..
this is achieved by
class <name>
{
//member variables
//member functions
};
class binds all the code implementation..
and Abstraction is a process of hiding/denied permission to
use data of one class to other class (inherited)
this is achieved by private keyword in class..
Is This Answer Correct ? | 10 Yes | 0 No |
Answer / ramaraju
Encapsulation is a process of binding data and methods into
a single unit.
Abstraction is a process where by we identify important
aspects of phenomenon and ignoring its details.
Is This Answer Correct ? | 17 Yes | 9 No |
Answer / abc
encapsulatin is hiding the internal data and methods from
the outside world.
Abstraction is binding the similar data and methods which
can be accessible by its subclassess
Is This Answer Correct ? | 8 Yes | 0 No |
Answer / rajendar gunnala
Encapsulation: Related data and relevant functionality make
it as a unit to protect the data from outside world.
Abstraction : Client is abstracted from implementation.
class only exposes only interfaces ans hides implementation.
Is This Answer Correct ? | 10 Yes | 4 No |
Answer / trinadh
Encapsulation which when implemented properly makes a
programmer's class must more secure as he gives only class
behaviours but not instance variables to maniplate state
of an object.
Abstraction wil gives only required information among all
informations
Is This Answer Correct ? | 6 Yes | 0 No |
Answer / amruta
in encapsualtion i m hiding what the data is i.e i m
binding them into a single unit...i can use access
specifiers to do it.
but in abstraction i can see wht the mathods are but cant
see the actual implementation..i.e i cant understand what
it is but not understand it how it is..
Is This Answer Correct ? | 6 Yes | 3 No |
What is the use of OninitDialog ?
1)How to change a text of a button in runtime?
1) Enable or disable a Cancel button at run time?
Explain in sort What is CTargetObject?
1) create ToolTip in MFC?
List out the parameters of WinMain Function.
What is serialization ?which function is responsible for serializing data ?
what is the component of CLR ?
what is functioning of DIalodDataXchange ..?
1)dynamic creation of a Button ?
what message is sent to an application when the user presses the primary button?
How to setup a timer?