Encapsulation (computer programming): Difference between revisions

Content deleted Content added
No edit summary
An information-hiding mechanism: removed "older" from sentence. This falsely implied that lack of object-orientation is a trait of old proglangs. However, that trait is intentional in much newer proglangs as well - for example Lua (although it...
Tags: Mobile edit Mobile web edit
Line 122:
</source>
 
Encapsulation is also possible in older, non-object-oriented languages. In C, for example, a structure can be declared in the public API (i.e., the header file) for a set of functions that operate on an item of data containing data members that are not accessible to clients of the API:
<source lang="csharp">
// Header file "api.h"