What is the difference between abstraction and encapsulation in OOP?

  • Abstraction is bundling data and methods while encapsulation is exposing implementation details.
  • Abstraction is bundling data and methods while encapsulation is hiding implementation details.
  • Abstraction is exposing implementation details while encapsulation is bundling data and methods.
  • Abstraction is hiding implementation details while encapsulation is bundling data and methods.
Abstraction in OOP refers to the concept of hiding complex implementation details and showing only essential features of an object. Encapsulation, on the other hand, involves bundling the data (attributes) and methods (functions) that operate on the data into a single unit, i.e., a class. This helps in achieving data hiding and access control.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *