Content deleted Content added
No edit summary Tag: Reverted |
1AmNobody24 (talk | contribs) Undid revision 1273872865 by 2.188.26.192 (talk) unattributed copying from https://doi.org/10.22037/afb.v10i2.41131 |
||
Line 188:
Encapsulation is also possible in non-object-oriented languages. In [[C (programming language)|C]], for example, a structure can be declared in the public API via 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 with the <code>extern</code> keyword.<ref>{{cite book |last1=King |first1=K. N. |url= |title=C Programming: A Modern Approach |date=2008 |publisher=W. W. Norton & Company |isbn=978-0393979503 |edition=2nd |page=464}}</ref>
<syntaxhighlight lang="c">
// Header file "api.h"
struct Entity; // Opaque structure with hidden members
Line 243 ⟶ 241:
redcar.drive() # This will print 'Maximum speed is 10.'
</syntaxhighlight>
== See also ==
* [[Inheritance (object-oriented programming)]]
|