What is compile time binding and run time binding? (or) What is early/late binding? Explain with an example.

Thursday, July 9, 2009




An object is early bound when it is assigned to a variable declared to be of a specific
object type. Early bound objects allow the compiler to allocate memory and perform other

optimizations before an application executes.



' Create a variable to hold a new object.

Dim FS As FileStream

' Assign a new object to the variable.

FS = New FileStream("C:\tmp.txt", FileMode.Open)



By contrast, an object is late bound when it is assigned to a variable declared to
be of type Object. Objects of this type can hold references to any object, but lack
many of the advantages of early-bound objects.


Dim xlApp As Object

xlApp = CreateObject("Excel.Application")

0 comments

Post a Comment

LinkWithin

Blog Widget by LinkWithin

Recommended Books