Types of binding

What is the difference between static binding and dynamic binding?


4 Answers
1-4 of  4
4 Answers
  • Static Binding is binding done at compile time whereas dynamic binding is the binding done at run time.Static Binding is faster than dynamic binding. 

  • There are two types of binding-
    1-dynamic binding
    2-static binding

    Static and dynamic binding  are two important concept which every programmer should be aware of. This is directly related to execution of code. If you have more than one method of same name (method overriding) or two variable of same name in same class hierarchy it gets tricky to find out which one is used during runtime as a result of there reference in code. This problem is resolved using static and dynamic binding in Java. For those who are not familiar with binding operation, its process used to link which method or variable to be called as result of there reference in code. Most of the references is resolved during compile time but some references which depends upon Object andpolymorphism is resolved during runtime when actual object is available. 

  • Dynamic binding is achieved using virtual functions. Connecting the function call to the function implementation before execution is static binding whereas connection them at the run-time is dynamic binding. Static binding is done at compile time when a function is called in order to match it with the definition.

  •      STATIC BINDING                                            
     1)   The binding that occurs at compile time is called static binding.
     2)Static Binding is also called as Early Binding  
    3)Function Overloading and  Operator Overloading comes under Static Binding.
     4)Static Binding is fast
      
          DYNAMIC BINDING:            
     1)  The binding that occurs at runtime is called dynamic binding.
      2)Dynamic Binding is also  called as Late Binding.
      3)Function Overriding comes under Dynamic Binding.
     4)Dynamic Binding is slow

Object Oriented Programming

Didn't get the answer.
Contact people of Talent-Object Oriented Programming directly by clicking here