Tuesday, April 1, 2008

Late Binding & Early Binding

Binding -Association of methods to an object is referred as Binding.
Now Binding can occur in compile time and run or execution time as well.
Compile time Binding is a mechanism where memory is allocated during compilation of a program
for instance
in java,
primitive datatypes like integers as int,float,double,String etc the memory allocated during compile time.
This concept gives us concept of Early Binding.
Late Binding-is a mechanism where memory is allocated by wish of coder and need of a program.
For this,
a new operator is come into play.
for instance,
Fruit apple=new Fruit();
When our program which includes the above statement after compilation (where no memory is allocated in variable apple of type class Fruit).On execution or run apple is recognized and allocated somewhere in memory.
This state exists in execution time only.And the concept gives us the concept of LateBinding.

No comments: