Questions tagged [dynamic-binding]

Dynamic binding (aka dynamic dispatch) is the process of mapping a message to a specific piece of code (method) at runtime.

257 questions
2
votes
3 answers

How are subclasses of an interface get called

This is a question that has been bothering me for a while. In frameworks like Jersey we have interface(s) that we can subclass to add some functionality to our program. for example to add request filtering in a RESt application we can implement…
Claudiga
  • 427
  • 1
  • 4
  • 15
2
votes
2 answers

How is dynamic binding implemented in Java?

I am aware that in C++, there is a virtual pointer in each instance pointing to a virtual table. But how is dynamic binding implemented in Java?
wei
  • 6,629
  • 7
  • 40
  • 52
2
votes
1 answer

Java - Multiple visitor patterns for the same class structure

So I have a class structure of expressions, composed by, Binary Expressions, Unary Expressions, all abstract, these expanding into their specific concrete classes of operations such as Add, Sub, Mul, Not, etc... Like such. I want to create 2…
spacing
  • 730
  • 2
  • 10
  • 41
2
votes
1 answer

How to call a method with dynamic dispatch (when method is part of a Module), in Ruby?

In Ruby language, I have to call dynamically a method that belong to a Module, having method name as a stored string (say: "ModuleName::Submodule:methodName") Let's consider this case: module Dialogs def paperino(param) puts "paperino.…
Giorgio Robino
  • 2,148
  • 6
  • 38
  • 59
2
votes
1 answer

Is there a language allowing dynamic binding for arguments?

Is there a language allowing a supertype A defining a method useFoo (Foo foo) such as B, derivated from A defining a method useFoo(Bar bar), (Bar is derivated from Foo), when using B as a A with a Foo that is a Bar, it will run the most specialised…
Pierre-Antoine Guillaume
  • 1,047
  • 1
  • 12
  • 28
2
votes
0 answers

OSX: Dynamically binding a dylib with the loading executable

I'm loading a dylib from an OSX executable using dlopen. I would like the dylib to resolve it's symbols by binding back with the original executable. Is this possible? Note that the main executable will always have a known name, i.e. I don't need to…
Andrew Parker
  • 1,425
  • 2
  • 20
  • 28
2
votes
2 answers

C++ Static & Dynamic Binding behaviour

I understand the difference between static and dynamic binding in the sense that method calls are determined at compile time for static binding - whereas method calls are determined at run time for dynamic binding. One thing I don't get is why you…
2
votes
1 answer

Are base calls dynamically bound in c#?

Just out of curiosity: are calls using the base keyword in C# dynamically bound (i.e. is it a polymorphic call)? Consider the following example: public class A { public virtual void WriteSomething() { Console.WriteLine("Hello from…
feO2x
  • 5,358
  • 2
  • 37
  • 46
2
votes
3 answers

passing derived object as base class reference parameter

This examples shows a derived class object being passed to a function which takes reference to base class as the parameter. Member function g(int) in the derived class hides the g(float) in the base class. I understand that and my question is not…
irappa
  • 749
  • 4
  • 11
2
votes
2 answers

Is all dynamic binding a kind of polymorphism?

Is all dynamic binding considered to be polymorphism? Specifically, I'm talking about Java. If not, please explain both terms. What I know: not all inheritance is polymorphism but inheritance is used in all polymorphism.
2
votes
1 answer

ASP.NET MVC dynamically bind editor template

Is it possible to dynamically add an Editor Template to my view, after a button is clicked, for example? At the moment I'm doing this in my main view to bind a list of ObjectA objects to my model (inside a form): @Html.EditorFor(x => x.ObjectA) and…
2
votes
1 answer

Overridden methods and dynamic binding

Is there a possibility for an overridden method to be resolved statically? And what is the relation between Invoke virtual and dynamic binding? Are all invoke virtual methods dynamically bound? class Dynamic { public void display() { …
2
votes
2 answers

Java static and dynamic binding, upcast, overloading mixed together

Let's say that we have the following code class TestEqual{ public boolean equals(TestEqual other ) { System.out.println( "In equals from TestEqual" ); return false; } public static void main( String [] args ) { Object t1 = new…
Silent Control
  • 614
  • 10
  • 22
2
votes
3 answers

How can an object type be unknown at compile time?

I am currently learning about dynamic binding and virtual functions. This is from Accelerated C++, chapter 13: [...] We want to make that decision at run time. That is, we want the system to run the right function based on the actual type of the …
usual me
  • 8,338
  • 10
  • 52
  • 95
2
votes
4 answers

Function name and dynamic binding in Common Lisp

I'm reading Peter Norvig's Paradigms of AI. In chapter 6.2, the author uses code like below (not the original code, I picked out the troubling part): Code Snippet: (progv '(op arg) '(1+ 1) (eval '(op arg))) As the author's original intent, this…
Jiaji
  • 175
  • 11