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
3
votes
2 answers
Why is this a static binding instead of dynamic binding?
I'm still a little confused with regards to the difference between static and dynamic. From what I know dynamic uses object while static use type and that dynamic is resolved during runtime while static is during compile time. so shouldn't…

Challenger
- 251
- 2
- 13
3
votes
2 answers
Virtual function in C++
In the below c++ code using virtual functions
#include
using namespace std;
class Base{
public:
virtual void fun(){
cout << "Base::fun()called \n";
}
};
class Child : public Base {
public:
void fun() {
…

Zaks
- 668
- 1
- 8
- 30
3
votes
3 answers
What is the difference between compile time linking and run time linking?
I am currently reading a book and stuck at following code:
public class TestAnimals {
public static void main (String [] args ) {
Animal a = new Animal();
Animal b = new Horse();
a.eat(); // Runs the Animal version of…

Sandeep Gupta
- 43
- 5
3
votes
2 answers
Local dynamic binding in common lisp
Honnestly, I'm not sure I fully understand what it means for a binding to be "dynamic" versus "lexical". But I understand that when I use defvar or defparameterto define a binding, 1. it declares a global variable 2. the binding is declared…

Charles Langlois
- 4,198
- 4
- 16
- 25
3
votes
3 answers
Guice : Set bindings from an XML file
I'm trying to use Guice and make all the bindings with the help of an XML file. In my module (let's say "CustomModule"), I would like to load an XML file and parse it to set all the bindings.
I'm able to load the XML file and retrieve all the values…

Jacks
- 587
- 5
- 28
3
votes
1 answer
No dynamic binding when abstract type involved in Scala?
When I was trying the Animal/Food example for abstract types in Martin Odersky's Programming in Scala,
class Food
abstract class Animal {
type SuitableFood <: Food
def eat(food:SuitableFood)
}
class Grass extends Food
class Cow extends Animal {
…

lcn
- 2,239
- 25
- 41
3
votes
1 answer
What is a "top-level binding"?
I came across the expression top-level binding used within the context of dynamically typed languages and variable assignment.
What is meant by top level and how does this differ from normal lexical binding or dynamic binding?
Adding surrounding…

chb
- 1,727
- 7
- 25
- 47
3
votes
7 answers
Java referencing final variable before is has been initialized
I have this superclass Creature and its subclass Monster. Now I have this problem of a final variable being referenced without it being initialized.
public class Creature {
private int protection;
public Creature(int protection) {
…

Confituur
- 495
- 1
- 6
- 16
3
votes
2 answers
How to bind some function to non exist element?
My problem: after load some element via ajax, i bind some on-click function, but when user will load few times that same element, binded action will be repeat (not replace, at least that it looks like). I tried unbind, or click(function(){return…

IProblemFactory
- 9,551
- 8
- 50
- 66
3
votes
1 answer
How do I define dynamic and just-in-time bindings with Guice?
I am trying to use Guice for a test framework based on TestNG. This frameworks analyzes the test class for dependencies and provides them eliminating the need to build them in tests.
Guice is all about injection and I think is a good fit for the…

artemb
- 9,251
- 9
- 48
- 68
2
votes
1 answer
Using AppDomain.CreateInstanceAndUnwrap to create an instance of type T and then early binding to a method of type T
In the MSDN documentation for the AppDomain.CreateInstanceAndUnwrap method, it states as a note
If you make an early-bound call to a method M of an object of type T1 that was returned by CreateInstanceAndUnwrap, and that method makes an early-bound…

Calvin Grunewald
- 118
- 1
- 9
2
votes
1 answer
How to dynamically bind a run's background brush to a resource?
In my app.xaml:
In my code-behind:
Run run = new Run("My…

BigScary
- 530
- 1
- 6
- 19
2
votes
3 answers
Why this static binding doesn't work as i would expect?
I have a question about how this program selects the method.
Code(constructors aside):
class Father {
int x;
..
public int m(Father f) {
return (f.x - this.x);
}
}
class Son extends Father {
int y;
...
public int…

wattbatt
- 447
- 2
- 13
2
votes
4 answers
Why do some languages prefer static method binding rather than dynamic?
Why is the default decision in C++, C#, and Ada 95 to use static method binding, rather than dynamic method binding.?
Is the gain in implementation speed worth the loss in abstraction and re-usability?

Glove
- 960
- 6
- 17
- 30
2
votes
1 answer
What's happening when the special variable is declared during compile time
I just met an unusual situation in my common lisp code when I wanna test locally and declare:
(defvar test-out 2) ;; make a dynamic variable
;; function below just simply re-write from locally doc
(defun test (out)
(declare (special out))
(let…

ccQpein
- 705
- 7
- 20