Abstraction vs. Data Hiding

Abstraction and Data hiding are the significant concepts of object-oriented
programming. Abstraction is a process of
expressing the critical properties without
involving the background details while Data hiding insulates data from the straight
access by the program. However, both the concepts sound to be similar
but these are different. The abstraction provides a means to produce
user-defined data types for designing real-world objects using same properties while
data hiding protects the data and functions from unauthorized access.

Advertisement - Continue Reading Below
data hidding

Comparistion Chart

BasisAbstraction Data Hiding
Definition Extract only relevant information and ignore all
inessential details.
Hide all the data from the parts of the
Class Class use abstraction to derive a new
user-defined datatype.
Data hiding technique is used in a class to
make its data private.
Purpose To hide the complexity. To achieve encapsulation.
Focusses Observable behavior of the data. Allowing or Restricting the use of data
within a capsule.

What is Abstraction?

Abstraction is utilised to hide
the complexity. Abstraction Extract
only relevant information and ignore all inessential details. It indicates the necessary properties of
an object that distinguishes it from the other kinds of objects. An abstraction concentrates on external aspects
of an object. Abstraction provides the
separation of this crucial behaviour
from its implementation. It specifies a conceptual border relative to the
outlook of the viewer. A suitable abstraction highlights on the details that
are important for the user or reader and simplifies features which are,
irrelevant and deviant.

Advertisement - Continue Reading Below

User-defined data types are created by specifying abstract
attributes and functions inside a class for designing real-world objects,
having properties that are alike. These attributes are called data members
because they include the information. Likewise, the functions that operate on
these data are called member functions. The data
abstraction is implemented as a class which represents the important properties without including the
background explanations.

Kinds of Abstraction:

  • Procedural Abstraction:
    Procedural Abstraction includes series of the directions using the specified
  • Data Abstraction: It
    is a set of data that describes and specifies
    a data objects.
  • Control Abstraction:
     It is a program control mechanism where interior
    details are not specified.
Advertisement - Continue Reading Below

What is Data hiding?

Data hiding suggests the hiding of the data in the components
of the program that do not need to be retrieved. The isolation of the data from direct access by the program is
known as data hiding or information hiding. For executing data hiding,
encapsulation is used where data and
function of a class are protected from unauthorized access. In contrast, once the data
and function are encased into one unit is known as encapsulation. Thus, the data
hiding assists in attaining the
encapsulation. The operational details of an item can be managed through access

By using data hiding concepts,
the data and function in a class are private so that it couldn’t be accessed by the functions outside the class
and protected from accidental alteration.

Key Differences
Between Abstraction and Data Hiding

  1. Abstraction shows only
    relevant information and rejects the
    non-essential details While data hiding is used
    to hide data from the parts of the program.
  2. The prior aim of abstraction is to chide complex implementation detail of the program or
    applications. On the other hand, data hiding is implemented to attain
  3. Abstraction is used in class to make a new user-defined
    datatype while in classes data hiding is
    used to make data private.
  4. The abstraction focuses on the
    observable behaviour of data and data hiding limits or enables the use of data within a capsule.


The two abstraction
and data hiding intended to show only the required
information and hiding the
inessentials details but for the distinct
purpose. Abstraction highlights in hiding implementation
complexity on the other hand in data hiding the prominence is given to the
protection of data against the unauthorised access.

Leave a Comment