DATA ABSTRACTION VS DATA ENCAPSULATION
COMPARISON BETWEEN DATA ABSTRACTION VS DATA ENCAPSULATION
Fig. Credit : knowledge hub
DATA ABSTRACTION :-
Data Abstraction is the showing of only necessary
details of the object and Hiding the unnecessary
and unwanted details . For example , just like how a car shows but hides the
circuitry/ implementation.
Fig. Credit : knowledge hub
DATA ENCAPSULATION :-
Wrapping
of data just hiding properties and methods. The data should not go out
directly i.e. outside person is not
allowed to access the data .For example , just like how the implementations of bank account details are hidden from the
banker .
Fig. Credit : knowledge hub
DIFFERENCE BETWEEN DATA ABSTRACTION VS DATA ENCAPSULATION :-

Fig. Credit : knowledge hub
Parameters
|
Data Encapsulation
|
Data Abstraction
|
Definition
|
Binding the data members
and member functions together is called encapsulation.
|
Abstraction is an act of
representing essential details without including the background details.
|
Purpose
|
Encapsulation is data
hiding.
|
Abstraction is hiding of
complexity.
|
Known as
|
Wrapping of data.
|
Data Hiding.
|
Problem solved
|
In implementation level.
|
In design level.
|
Wrapping of data
|
Yes.
|
No.
|
Showing of necessary details
|
No.
|
Yes.
|
Focuses on
|
Restricting and allowing use of data.
|
Observable behavior of
data.
|
Layout
|
Inner layout because of implementation
level.
|
Outer layout because of
design level.
|
Use / implementation
|
Using Access Modifier.
|
Using Interface and
Abstract Class.
|
Example
|
Inner implementation detail
of mobile phone etc….
|
Outer look of mobile phone
etc….
|
Main advantage
|
Achieve security.
|
Achieve security as we are
not highlighting internal implementation.
|
Comments
Post a Comment