answersLogoWhite

0


Best Answer

There is Static binding and also Dynamic binding. The compiler has to choose from one or the other. Stactic binding defines the properties of the variables at compile time. Therefore, they can't be changed. In dynamic binding the properties of the variables are determined at runtime. Since the variables can change in form, dynamic binding is more flexible but slower. A great example is given in wikipedia it states: Suppose all life-forms are mortal. In object oriented programming, we can say that the Person and Plant classes must implement the Mortal interface, which contains the method die(). Persons and Plants die in different ways; for example, Plants do not have hearts that stop. Dynamic binding is the practice of figuring out which method to invoke at runtime. For example, if we write void kill(Mortal m) { m.die(); } it's not clear whether m is a Person or a Plant, and thus whether Plant.die() or Person.die() should be invoked on the object. With dynamic binding, the m object is examined at runtime, and the method corresponding to its actual class is invoked.

User Avatar

Wiki User

βˆ™ 15y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Advantages of dynamic binding
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Explain the concept of late binding and dynamic binding with the help of at least two examples?

the concept of dynamic linking and dynamic binding with example


Static vs dynamic binding in c plus plus?

Static binding occurs at compile time. Dynamic binding occurs at runtime.


What are the Advantages and disdvantages of dynamic model?

Advantages of dynamic model


Why dynamic binding is not possible for normal C functions?

Dynamic binding is certainly possible for normal C functions. Binding is a function of the binder (linker) and has nothing to do with the language itself.


What is dynamic binding in java?

Dynamic Binding means declaring variables at run time only rather than declaring it at compile time.


Is late binding and dynamic binding related to polymorphism?

Late binding and dynamic binding are related to runtime polymorphism. By contrast, compile time polymorphism is known as static binding. Template functions and classes are examples of static binding because the exact type can be determined at compile time.


When dynamic binding approach in oops?

at runtime


What is Difference between dynamic polymorphism and static polymorphism with example?

Static polymorphism is used the concept of early binding or we can say compile time binding where as dynamic polymorphism used the concept of late binding or run time binding.


Why does C plus plus allows static binding and not dynamic binding?

Dynamic binding, or late binding, is when the object code for the class does not get loaded into memory until it is needed. This saves time at module load time, at the cost of delayed execution for the first invocation.


What is binding in oops?

Binding is defined as the connection between the function call and the corresponding program code to be executed. There are two types of bindings. They are; 1.static binding and 2.Dynamic binding.


Which process of assigning a value to an attribute at the run time is?

Dynamic binding


What is the other name for polymorphism?

It is also called 'Dynamic binding of Function'