Abstraction and encapsulation in oop?

are youtubers confused about these 2 terms when it comes to oop? i have seen 3 videos about oop so far, 2 of them explain that abstraction is hiding the rest of how a program works and showing only what you need to use in it, another video is explaining that encapsulation is the fact that objects hide the rest of the code in an object and gives you only access to the methodes of the class which used to create that object. can anybody give me a simple explination of abstraction and encapsulation in oop? if they sound similar, what is the diffrence? thank you.
oop: object oriented programing.

Perhaps a very simple and high level view:

  • Abstraction: Eliminate complexity by hiding unnecessary details (concept/theory)
  • Encapsulation: The bundling of data and methods that operate on that data into a single unit (implementation)

Abstraction is more of the theory, while encapsulation is more of putting this theory into practice (e.g. using classes).

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.