Skip to content
EntityQ1305241· pop 40· linked from 106 articles

encapsulation

Sign in to save

language mechanism in programming languages that allows external code not to care about the internal workings of an object

Wikidata facts

Show 1 more fact
Sources (2)

via Wikidata · CC0

~8 min read

Article

In software systems, encapsulation refers to the bundling of data with the mechanisms or methods that operate on the data. It may also refer to the limiting of direct access to some of that data, such as an object's components. Essentially, encapsulation prevents external code from being concerned with the internal workings of an object.

Encapsulation allows developers to present a consistent interface that is independent of its internal implementation. As one example, encapsulation can be used to hide the values or state of a structured data object inside a class. This prevents clients from directly accessing this information in a way that could expose hidden implementation details or violate state invariance maintained by the methods.

Connections

Categories