What is early binding and late binding?
preetam sharma
Late Binding object o = 5; o.tostring(); Early binding: int i=10; i.tostring(); here the complier knows in case 2 that which version of tostring method is to be called [since int inherits from object, there are two versions of tostring method, but since it is directly known that the class of i is int then no need to resolve the version info for method tostring] whereas in case 1 compiler has to peep into the object to see which type of data is contained within the object and then depending upon that it selects the tostring method and calls it accordingly. Regards Samir
When a call to a method is resolved during compile time, it is called early binding. And if it is resolved during runtime, it is called late binding.
Early binding:
Manually binding the Object file is called early binding
eg .
Dim oExcel As Excel.Application Set oExcel = CreateObject("Excel.Application")
and
Late binding has the same effect as early binding. The difference is
that you bind the object library in code at run-time.
Dim oExcel As Excel.Object Set oExcel = CreateObject("Excel.Application")