answersLogoWhite

0


Best Answer

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.

User Avatar

Wiki User

13y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

11y ago

In simple terms, static binding occurs at compile time whereas dynamic binding occurs at runtime.

Dynamic binding implies that a class contains one or more virtual methods. Even if the class has no derivatives, a v-table (virtual table) must still be instantiated for it, and its methods must be dynamically bound at runtime. If the class is not expected to be derived from, then it's hard to justify declaring virtual methods for it in the first place. However, if the class is itself derived, then dynamic binding must still take place within the base classes that declare virtual methods.

This answer is:
User Avatar

User Avatar

Wiki User

10y ago

C++ allows both static and dynamic binding. Static binding occurs at compile time. Dynamic binding occurs at runtime.

This answer is:
User Avatar

User Avatar

Wiki User

15y ago

no it cannot be

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Why does C plus plus allows static binding and not dynamic binding?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

Which binding in C plus plus is preferred and why?

There is no preference as such. The type of binding you use is more dependant upon the design and circumstance rather than any preference you may have. Static binding is certainly more predictable and therefore easier to program, but dynamic binding offers much greater flexibility.


How is dynamic initialisation achieved in c plus plus?

The C++ standard has this to say about dynamic initialisation:"Objects with static storage duration shall be zero-initialised before any other initialisation takes place. Zero-initialisation and initialisation with a constant expression are collectively called static initialisation; all other initialisation is dynamic initialisation."


How ploymorphism and inheritance is different from that in Java and c plus plus?

C++ allows multiple inheritance while Java does not. In my opinion, multiple inheritance is not useful because it can get very confusing very quick. For polymorphism, C++ does early binding by default, while Java does late binding by default. Late binding is more useful than early binding.


Representation of stack data structure in c plus plus?

Stack is an abstract data type that allows you to input and output data in a way that the first data which was placed in the stack will be the last one to get out. We use physical examples of stack in our daily lives such as the stack of dishes or stack of coins where you only add or remove objects from the top of the stack. You can see the implementation in c++ in related links, below.


What is a static binding c plus plus?

In its simplest definition, "binding", when referred to in the context of any computer programming language, describes how a variable is created and used (or "bound") by and within the given program and, possibly, by other programs, as well. However, there are other definitions for "binding" in computer programming languages, which would take too long to list and explain, especially given the broad nature of the question.

Related questions

Static vs dynamic binding in c plus plus?

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


Does c and c plus plus support static or dynamic binding?

Yes and no. Static vs dynamic binding is not a C or C++ language issue; it is a linker issue. If you link with a .lib file that contains stubs for run-time loading, then the called routine will not be loaded until it is invoked, and it will not be made a part of the load module.


Which binding in C plus plus is preferred and why?

There is no preference as such. The type of binding you use is more dependant upon the design and circumstance rather than any preference you may have. Static binding is certainly more predictable and therefore easier to program, but dynamic binding offers much greater flexibility.


How is dynamic initialisation achieved in c plus plus?

The C++ standard has this to say about dynamic initialisation:"Objects with static storage duration shall be zero-initialised before any other initialisation takes place. Zero-initialisation and initialisation with a constant expression are collectively called static initialisation; all other initialisation is dynamic initialisation."


What are the various concepts of c plus plus?

1.Classes and Objects 2.Constructors and Destructors 3.Inheritance 4.Polymorphism 5.Dynamic Binding


C plus plus uses dynamic memory management?

No, C++ does not use dynamic memory management. The programmer is entirely responsible for releasing dynamic memory when it is no longer required. When static objects fall from scope, their destructors are called automatically, but there is no automatic garbage collection for dynamic objects. Allocated memory remains allocated until the programmer manually releases it, or the thread that owns the memory is terminated.


How ploymorphism and inheritance is different from that in Java and c plus plus?

C++ allows multiple inheritance while Java does not. In my opinion, multiple inheritance is not useful because it can get very confusing very quick. For polymorphism, C++ does early binding by default, while Java does late binding by default. Late binding is more useful than early binding.


How dynamic binding acheived in c plus plus?

Dynamic binding is achieved via virtual functions and the virtual table that is associated with every class that declares or inherits a virtual function. The virtual table (or v-table) maps every virtual function (including pure-virtual functions) to a function pointer that points to the most-derived overload. This makes it possible to invoke specific behaviour even when the runtime type of the object is unknown to the caller.


What is binding in c plus plus?

Binding refers to classes and their member methods. A class that has no virtual methods can simply be bound to all its methods at compile time. This is known as static binding. However classes with virtual functions require special handling as they can be overridden by derived classes. If the derived class cannot be determined at compile time, then its overridden methods are dynamically bound at runtime, using the virtual table (or v-table) to determine which version of a method must be called.


Why c plus plus is not complete object oriented language?

because c++ supports all the basic concepts of oop :1.objects,2.classes,3.data abstraction and encapsulation,4.inheritance,5.polymorphism,6.dynamic binding,5.message passing.


What is the difference between dynamic loading and late binding in C plus plus?

Late binding occurs when the compiler does not have enough information to verify a method exists for a given function signature and therefore cannot bind that method to its allotted slot in the v-table. The method must instead be located by its name at runtime, which will incur a performance penalty every time that method is called. Early binding is more efficient and is therefore the preferred method of binding virtual methods, but late binding exists to cater for those cases where early binding is simply not an option. Dynamic loading occurs when a library may or may not be available at compile time and must be loaded at runtime. All symbols exposed by the library must therefore be resolved at loadtime. If the library is not available at loadtime the program should be engineered to provide a graceful fallback. Dynamically loading libraries that also rely on late binding should be avoided wherever possible, but it may be the only solution available in some cases.


Representation of stack data structure in c plus plus?

Stack is an abstract data type that allows you to input and output data in a way that the first data which was placed in the stack will be the last one to get out. We use physical examples of stack in our daily lives such as the stack of dishes or stack of coins where you only add or remove objects from the top of the stack. You can see the implementation in c++ in related links, below.