Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Nested function
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
=== Modularity === A common alternative is to leverage a language's modularity technology. Some functions are exposed for use outside of the module and some are only visible within the module. In C, this can be implemented by declaring functions and variables as ''static'' to hide them from code outside the file.<ref name=cfaq>"[http://c-faq.com/misc/nestfcns.html Question 20.24: Why doesn't C have nested functions?], comp.lang.c FAQ</ref> This allows for data hiding, encapsulation and decomposition, but at a different level of [[granularity]] than with nested functions. This modularity does not support more than one level of nesting. In [[object-oriented languages]], a class typically provides a scope in which functions and state can be hidden from consumers of the class but accessible within the class. Some languages allow classes to be nested.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)