What is the difference between abstraction and encapsulation?

1 Answers
Answered by suresh

Abstraction vs Encapsulation - OOPS Interview Question

Abstraction vs Encapsulation

Abstraction: Abstraction is the process of hiding complex implementation details and showing only the necessary features of an object. It allows us to focus on what an object does, rather than how it does it.

Encapsulation: Encapsulation is the bundling of data and methods that operate on that data into a single unit. It protects the data from unwanted access and modification by enforcing access restrictions, such as using private and public access modifiers.

In summary, abstraction is about showing only the necessary information about an object, while encapsulation is about bundling data and methods together and controlling access to them.

Answer for Question: What is the difference between abstraction and encapsulation?