Encapsulation

Before Object-Oriented Programming, we have procedural programming where we just have functions modifying data with no real structure. Object-Oriented Programming puts things in an Object in a container and organizes things into units that model real-world applications.

The encapsulation that we wrap the code into boxes that are related to one another. So that these boxes can just interact with each other using the methods and properties that we can use. This makes code easier to maintain and more reusable. Again, encapsulation refers to the bundling of data with the methods that operate on that data, or the restricting of direct access to some of an object’s components. Encapsulation is used to hide the values or state of a structured data object inside a class, preventing unauthorized parties’ direct access to them.

Leave a Reply

Your email address will not be published.

ANOTE.DEV