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
Name binding
(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!
==Binding time== * ''Static binding'' (or ''early binding'') is name binding performed before the program is run.<ref name=ieee24765:2010(E)>{{Citation |title=Systems and software engineering β Vocabulary ISO/IEC/IEEE 24765:2010(E)|publisher=IEEE |date=Dec 15, 2010}}</ref> * ''Dynamic binding'' (or ''[[late binding]]'' or ''virtual binding'') is name binding performed as the program is running.<ref name=ieee24765:2010(E) /> An example of a static binding is a direct [[C (programming language)|C]] function call: the function referenced by the identifier cannot change at runtime. An example of dynamic binding is [[dynamic dispatch]], as in a [[C++]] virtual method call. Since the specific type of a [[Polymorphism (computer science)|polymorphic]] object is not known before runtime (in general), the executed function is dynamically bound. Take, for example, the following [[Java (programming language)|Java]] code: <syntaxhighlight lang="java"> public void foo(java.util.List<String> list) { list.add("bar"); } </syntaxhighlight> <code>List</code> is an [[interface (computing)|interface]], so <code>list</code> must refer to a [[Subtyping|subtype]] of it. <code>list</code> may reference a <code>LinkedList</code>, an <code>ArrayList</code>, or some other [[Subtyping|subtype]] of <code>List</code>. The method referenced by <code>add</code> is not known until runtime. In C, which does not have dynamic binding, a similar goal may be achieved by a call to a function pointed to by a variable or expression of a [[function pointer]] type, whose value is unknown until it is evaluated at run-time.
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)