Content deleted Content added
m v2.05b - Bot T20 CW#61 - Fix errors for CW project (Reference before punctuation) |
merge information from Object-oriented programming#Encapsulation |
||
Line 1:
{{Short description|Bundling of data}}
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.<ref name="Rogers01" /> Essentially, [[Encapsulation (computer programming)|encapsulation]] prevents external code from being concerned with the internal workings of an object.
Encapsulation allows developers to present a consistent It also encourages programmers to put all the code that is concerned with a certain set of data in the same class, which organizes it for easy comprehension by other programmers. Encapsulation is a technique that encourages [[Coupling (computer programming)|decoupling]].
All [[object-oriented programming]] (OOP) systems support encapsulation {{Citation needed|date=March 2023}}, but encapsulation is not unique to OOP. Implementations of [[abstract data types]], [[module (programming)|modules]], and [[library (computing)|libraries]], among other systems, also offer encapsulation. The similarity has been explained by programming language theorists in terms of [[existential types]].<ref>{{harvnb|Pierce|2002|loc=§ 24.2 Data Abstraction with Existentials}}</ref>
|