Dynamic binding (aka dynamic dispatch) is the process of mapping a message to a specific piece of code (method) at runtime.
Questions tagged [dynamic-binding]
257 questions
116
votes
9 answers
Static Vs. Dynamic Binding in Java
I'm currently doing an assignment for one of my classes, and in it, I have to give examples, using Java syntax, of static and dynamic binding.
I understand the basic concept, that static binding happens at compile time and dynamic binding happens at…

user2309750
- 1,403
- 4
- 14
- 11
105
votes
8 answers
What is the difference between Early and Late Binding?
What is the difference between early and late binding?

James A. Rosen
- 64,193
- 61
- 179
- 261
90
votes
12 answers
Java dynamic binding and method overriding
Yesterday I had a two-hour technical phone interview (which I passed, woohoo!), but I completely muffed up the following question regarding dynamic binding in Java. And it's doubly puzzling because I used to teach this concept to undergraduates…

Magsol
- 4,640
- 11
- 46
- 68
32
votes
6 answers
Static Binding and Dynamic Binding
I am really confused about dynamic binding and static binding. I have read that determining the type of an object at compile time is called static binding and determining it at runtime is called dynamic binding.
What happens in the code…

Abhinav
- 8,028
- 12
- 48
- 89
24
votes
9 answers
How do upcasting and vtables work together to ensure correct dynamic binding?
So, vtable is a table maintained by the compiler which contains function pointers that point to the virtual functions in that class.
and
Assigning a derived class's object to an ancestor class's object is called up-casting.
Up-casting is handling a…

Aquarius_Girl
- 21,790
- 65
- 230
- 411
23
votes
6 answers
Gridview row editing - dynamic binding to a DropDownList
I'm trying to get an ASP.NET 3.5 GridView to show a selected value as string when being displayed, and to show a DropDownList to allow me to pick a value from a given list of options when being edited. Seems simple enough?
My gridview looks like…

marc_s
- 732,580
- 175
- 1,330
- 1,459
18
votes
6 answers
Question about Java overloading & dynamic binding
In the code below, how does first and second print statements print out SubObj??
Do top and sub point to the same Sub class?
class Top {
public String f(Object o) {return "Top";}
}
class Sub extends Top {
public String f(String s) {return…

user482594
- 16,878
- 21
- 72
- 108
17
votes
0 answers
Explanation on why a constructor cannot be virtual based on study : Correct the mistakes if any
I did some study to find out why a constructor cannot be virtual. I am consolidating my understanding here.
I will first explain what is a virtual function and then explain why a constructor cannot be virtual based on the first explanation.
What is…

nitin_cherian
- 6,405
- 21
- 76
- 127
16
votes
3 answers
LINQ select query with Anonymous type and user Defined type
Anonymous class has read only properties in c#. Which is often used to to declare in linq select query to get particular values from database.
In my code I have the following query.The thing that confused me selecting new object of anonymous class…

Muhammad Nasir
- 2,126
- 4
- 35
- 63
15
votes
5 answers
When to mark a function in C++ as a virtual?
Because of C++ nature of static-binding for methods, this affects the polymorphic calls.
From Wikipedia:
Although the overhead involved in this dispatch mechanism is low, it
may still be significant for some application areas that the language
…

Muhammad Hewedy
- 29,102
- 44
- 127
- 219
15
votes
3 answers
Mechanism of Vptr and Vtable in C++
In C++, during dynamic binding, consider the following example...
class Base
{
virtual void fun()
{
cout<<"Base";
}
};
class Derived : public Base
{
void fun()
{
cout<<"Derived";
}
};
int main()
{
Base *bptr;
…

Blue Diamond
- 2,979
- 4
- 18
- 21
13
votes
3 answers
Shallow & Deep Binding - What would this program print?
I'm not sure how to do this...
function f1()
{
var x = 10;
function f2(fx)
{
var x;
x = 6;
fx();
};
function f3()
{
print x;
};
f2(f3);
};
For each of the following two binding…

Ricky
- 823
- 2
- 14
- 31
12
votes
3 answers
What are good examples of using 'binding' in clojure?
I understand that the binding form allows rebindable dynamic scoping in clojure. So far the only uses I've seen it used for is for I/O such as with print where *out* is rebound to what ever writer you would like at the time.
I would like to see…

bmillare
- 4,183
- 2
- 23
- 42
11
votes
3 answers
Higher-order functions in Elisp
I created a function that returns a function in Elisp:
(defun singleton-set (elem)
(defun f (n) (= n elem))
f)
I try to run this in IELM, and it fails:
ELISP> (singleton-set 5)
*** Eval error *** Symbol's value as variable is void: f
ELISP>…

Mirzhan Irkegulov
- 17,660
- 12
- 105
- 166
10
votes
1 answer
Dynamically binding lists with Spring's form tag
I have a command object FaxForm and it holds a list of FaxStatus objects inside a faxStatusList property.
public class FaxForm {
private List faxStatusList;
public void setFaxStatusList(List faxStatusList) {
…

ravun
- 1,523
- 9
- 27
- 45