What is the difference between Abstraction and Encapsulation? - ProProfs Discuss
Topics
Products
Follow Us:

What is the difference between Abstraction and Encapsulation?

Asked by G. GRAY, Last updated: Apr 21, 2020

+ Answer
Request

1 Answer

G. Jabez

G. Jabez

Answered Mar 30, 2020

Abstraction and Encapsulation look very similar in terms of meaning, especially as they relate to object-oriented programming. Both concepts are often considered to be inseparable. However, let's check their meanings and see if there are some differences between the two concepts.

Abstraction simply refers to a concept used in oop, which helps in concealing or hiding certain details that are considered irrelevant so as to eliminate redundancy and enhance efficiency. On the other hand, encapsulation simply refers to a mechanism that helps in enclosing data and information as if they are wrapped in a capsule in order to prevent unnecessary interference with the data or information.

While abstraction is just a way of hiding irrelevant details, encapsulation is trying to hide certain data or information so as to restrict people from accessing it. Interface and abstract class are usually used to implement abstraction, while encapsulation is mostly implemented using modifiers that require private access.

 

Search for Google images
Select a recommended image
Upload from your computer
Search for Google images
Select a recommended image
Upload from your computer
Search for Google images
Select a recommended image
Upload from your computer

Email Sent
We have sent an email to your address "" with instructions to reset your password.