What is the difference between Abstraction and Encapsulation? - ProProfs Discuss
Advertisement

What is the difference between Abstraction and Encapsulation?

Asked by G. GRAY, Last updated: Apr 10, 2024

+ Answer
Request
Question menu
Vote up Vote down

1 Answer

G. Jabez

G. Jabez

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.

upvote downvote
Reply 

Advertisement
Advertisement
Search for Google images Google Image Icon
Select a recommended image
Upload from your computer Loader
Image Preview
Search for Google images Google Image Icon
Select a recommended image
Upload from your computer Loader
Image Preview
Search for Google images Google Image Icon
Select a recommended image
Upload from your computer Loader

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