259
questions
0
votes
1
answer
64
views
difference between runtime and compile time with regard to dynamic binding [duplicate]
I am learning C++ and if I have classes
class Core {...}
class Grad: public Core {...}
then
Core* p;
Core& ref;
may be Grad objects which is not determined at compile time but at runtime hence ...
1
vote
1
answer
74
views
Java-dynamic-binding-problem-understanding
So, I have this problem (which I am guessing has something to do with dynamic binding) that I can not wrap my head around.
class A {
public int m(A p) {
return 12;
}
public int n(...
0
votes
0
answers
45
views
Why does the dynamic binding of following code seem not to work? [duplicate]
This code's output is "test of X", but it's expected to be "test of Z".
public class test {
public static void main(String[] args) {
X x = new X();
x = new Z();
...
0
votes
1
answer
94
views
How virtual keyword leads to dynamic binding?
I know the following
Compiler constructs a virtual table for every class containing at least one virtual function. It also adds a pointer(v_ptr) to the base class(supposing it has virtual function(s)) ...
2
votes
0
answers
139
views
difference between __got section and __nl_symbol_ptr section
Both of them are labeled as S_NON_LAZY_SYMBOL_POINTERS and are bound at load time. However, I only see the __DATA__CONST.__got section in most Mach-O files.
What's the difference between them and why ...
0
votes
2
answers
106
views
Why Derrived pointer binds statically to Derived object meanwhile a Base pointer binds dynamically to Base object?
In the attached code why:
p1->print(); binds dynamically?
and why:
p2->print();
binds statically ?
#include<iostream>
class Base{ public:
virtual void print()
{ std::cout<<&...
-1
votes
1
answer
66
views
When multiple variables refer to same python list, and if value of one variable is changed, other variable is also changed autommatically. Why? [duplicate]
I have the below small code in Python where I am changing the value of list_one by using pop() function but I am not doing any changes in list_two. on printing list_one and list_two they both print ...
0
votes
1
answer
209
views
Dynamically binding of overridden methods
I'm trying to understand when the compiler has, or not, all the information needed to decide statically or dynamically how to bind method calls to method definitions.
I read that in Java there is a ...
0
votes
0
answers
77
views
Using dynamic binding to create an instance of a class which implements an interface
I'm implementing a board game for two players. Users are able to create their own AIs for the game and add them to the game. These AIs also can implement own, more efficient versions (data structures) ...
0
votes
1
answer
71
views
Dynamic binding datetimepicker
I'm populating the page on load from php data. The datetimepicker class have been added to date field type input-text. This elementts are displayed in row similar to standard table but wrapped with ...
1
vote
1
answer
104
views
How Dynamic Binding (with hiding) works?
I have been practicing Dynamic Binding (with hiding) and i came across a code block like below.
The output of the program is:
"I am a B"
And I just couldn't understand it.
Can anyone can ...
0
votes
0
answers
64
views
is it ok to use dynamic bind to implement polymorphism instead of pointer?
generally in c++ we use virtual class and pointers to achieve polymorphism, but recently I accidently made it with dynamic binding with std::function
sample:
class base {
using func_t = std::function&...
0
votes
0
answers
272
views
Bind value to image dynamically in angular
I am generating multi qr code image and need to bind scr.Value to image tag.The image doesn't show for me.Pls let me know any changes to be done to this line <img class='boxqrcode' [src]="'...
1
vote
1
answer
2k
views
Nuxt Dynamic V-model
I'm having difficulty binding my custom input to data(). I've tried several combinations to try to get it working and so far only the placeholder seems to work. I created an array called questions and ...
0
votes
1
answer
172
views
Dynamic Binding java test
Doing this java exercise I can't figure out why the last line print out "5".
public class Customer { }
public class RegisteredCustomer extends Customer{}
public class Shop {
public int ...
0
votes
0
answers
51
views
Why is method which accepts sub-class object doesn't recognize object of sub-class with the reference of the superclass?
I have two classes(Vector and Stack) the one extends another.Resourse class has four methods.
When I pass a object of sub-class with reference of super-class it calls method that accepts super-class ...
0
votes
0
answers
21
views
C++: calling inherited virtual method using derived class pointer (pointing to derived class object) is resulting in compilation error [duplicate]
Following code results in compilation error.
error: no matching function for call to ‘D::print(int)’
Error is at following line
d_ptr->print(5);
#include<iostream>
using std::cout;
...
0
votes
1
answer
801
views
Spring Cloud Stream + Kafka Dynamic Destination + Error handling
We have an application on Spring cloud Stream integrated with Project Reactor. We dynamically set the destination topic by setting the spring.cloud.stream.sendto.destination in the Message header and ...
1
vote
1
answer
71
views
Is it possible to inherit a class with generics when the base class also has generics?
I apologize for the confusing title, I'm not quite sure how to word my issue concisely.
Here, I have a class structure that does not compile.
class MyEvent
{ }
class EventA : MyEvent
{ }
class ...
4
votes
1
answer
2k
views
Virtual function calling a non-virtual function and vice versa
I have a class A as a base class of class B.
I have called the non-virtual function, abc(), within my virtual function, xyz(), as mentioned below.
Due to run-time polymorphism, B:xyz is called – I ...
-1
votes
2
answers
779
views
How to Explain Lexical vs Dynamic Binding?
I read a relevant post on binding, however still have questions.
Here are the following examples I found. Can someone tell me if the conclusions are correct?
Dynamic Binding of x in (i):
(defun j ()
...
0
votes
0
answers
43
views
C++: When is method redefinition preferred over virtual method override? [duplicate]
Do virtual methods bind statically when objects are not created dynamically?
If virtual methods have the best of both worlds (static and dynamic binding when needed), what is the point of having non-...
0
votes
1
answer
1k
views
Cases of static and dynamic binding in C++
The following code has 4 classes: Base1, Derived1 (derived from Base1), Base2, Derived2 (derived from Base2). Both base classes have integer data1 and display_data() functions. Both derived classes ...
0
votes
1
answer
447
views
Vue - How to dynamically set a grid area name
I have a list of objects that I loop through and generate inside the template. Those objects need to be positioned differently inside the grid depending on the screen size.
So I would like to use the ...
-1
votes
1
answer
177
views
Can Java have dynamic type binding for variables?
Can variables have dynamic type binding in Java? I know that methods can, but I don't think that variables can since every variable has to have a type declaration when it is created such as int, ...
1
vote
1
answer
817
views
Springboot application with dynamic rest api calls using kubernetes cluster
My spring boot application needs to call or consume rest api from another spring boot application.
I want to use Kubernetes to manage my application and its multiple instances. But I am struggling to ...
0
votes
1
answer
68
views
Dynamic binding for two arguments
This question concerns design patterns, and in particular dynamic binding, in statically typed languages (I use Kotlin here, but it could also be C++ or Java). The problem is as follows: I have an ...
-1
votes
2
answers
109
views
How to understand the dynamic binding in this C++ code?
This is my code. I need help making this Dynamic Binding work.
#include<iostream>
#include<conio.h>
using namespace std;
class Shape {
protected:
double x,y;
public:
void ...
0
votes
1
answer
502
views
I'm trying to make a derived class method available through a base class reference
I'm trying to call a derived class method with a base class reference but I do not want to implement it in the base class or other derived classes. Only in that one derived class.
One alternative I ...
0
votes
1
answer
193
views
c++ particle system inheritance
i'm creating particle system and i want to have possibility to choose what kind of object will be showing on the screen (like simply pixels, or circle shapes). I have one class in which all parameters ...
1
vote
1
answer
349
views
C++ Mixin - Dynamic Binding During Initialization idiom
I have a hierarchy of classes for which I want to use polymorphism to call the correct member functions.
On a basic level this works, but I encountered a problem when trying to use a Mixin class to ...
0
votes
1
answer
662
views
Is there a method to bind Tabulator to a dynamically created <div> element?
I am attempting to bind an instance of the Tabulator plug-in to a dynamically created <div> element but to no avail. I have no issue binding Tabulator to static elements created with the page ...
0
votes
1
answer
295
views
Polymorphism example? (Substitution principle and late dynamic binding)
Below is a snippet of my code and I can’t decide whether or not it is an example of Polymorphism.
Class hierarchy 1
Within my Player class (This is a subclass of Character) there is a method called ...
0
votes
1
answer
356
views
Azure Java Function, Get HttpTrigger body attribute value in BlobOutput path annotation
I have a HttpTrigger function with request body as
{
"id":"222",
"name":"some name"
}
I want to get the Id from request body into @BlobOuput path like below
@BlobOutput(name="blob", path="input-...
0
votes
1
answer
770
views
Trying to use a virtual function in my initialization list
I am trying to create a base and a derived class with a const member that has to be initialized:
class baseClan
{
public:
baseClan(const string firstName)
:
fullName(createFullName(...
2
votes
2
answers
316
views
Why do we need dynamic binding (Java)?
I've read many articles on the difference between static binding and dynamic binding in Java, but none of them really talk about why we need dynamic binding. Why is it that some code should only be ...
1
vote
1
answer
857
views
Dynamic binding, Static binding, Pointer to function, deep meaning
In static binding the decision of the method to be called is made at compile-time, in dynamic binding, the decision about the method to be called is made at run time.
Virtual methods are called with ...
0
votes
0
answers
266
views
Why there isn't a dynamic binding in the method arguments in Java?
I am wondering why there isn't a dynamic binding in Java in method arguments? Example:
static class C {
public static void test(C c) {
System.out.println("C");
}
}
static class D ...
1
vote
2
answers
84
views
What if I must override a non-virtual member function
Say we have a library which provides a class
struct Base { int foo() { return 42; } };
I cannot change that class.
99% of the people never want to override foo, hence it has not been made virtual by ...
2
votes
3
answers
190
views
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 ...
0
votes
2
answers
230
views
Why is dynamic binding necessary?
I cannot figure out why do we need dynamic binding (late binding). Let's say we have Class A and Class B and lets say that class B extends class A, now we can write stuff like "A var= new B();"
Now ...
1
vote
3
answers
2k
views
Base-class pointer pointing to a derived class cannot access derived-class method
I am learning inheritance in C++11, and I found that if a derived class has redefined a virtual function name but with a different prototype, a base-class pointer assigned with a pointer to the ...
1
vote
1
answer
283
views
Can you "dynamically bind" overloaded methods? [duplicate]
public class ConstructorOverloading {
static class A{
final String msg;
public A(Object o){
this.msg = "via object";
}
public A(Integer i){
...
0
votes
1
answer
1k
views
How to update(reload) columns of kendo grid after datasource read method?
I have Kendo MVC grid and the columns of the grid are dynamic based on the model that gets filled on the datasource read method. I need to loop through the dynamic columns to generate it on the grid.
...
0
votes
1
answer
148
views
Is there a way to bind a variable number of queries?
I'm coding an app for managing shift work. The idea is pretty simple: the team is shared between groups. In those groups are specific shifts. I want to get something like that:
Group 1
- shift11
- ...
-1
votes
1
answer
294
views
Cannot convert from 'typeA' to 'typeB' when attempting dynamic binding in C#
I'm trying to design an API that is supposed to have a certain method for each of the 20+ concrete classes that I need to support (I can't change those specs).
My first idea was to use overloading to ...
2
votes
1
answer
202
views
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
(...
1
vote
0
answers
21
views
Dynamic element not attaching to on() function?
Im currently using the on() function to attach to dynamic elements in my application which are loaded initially but then reloaded via ajax. Due to the reloading this code
$('a.open-drawer').on('click'...
1
vote
0
answers
139
views
What is the best inheritance hierarchy for this model in C++?
I have the above class model exported as DLL to users. Considering user convenience they will only require to instantiate a Base pointer, and use setMode(Mode) to initialize the Tank or Truck object. ...
1
vote
1
answer
86
views
Why can dynamic binding override name hiding in C++?
I learnt that inner names hides outer names (so overloading does not cross scope) because name lookup goes before type matching. So I write the following C++ code to play with this rule:
class Base {
...