What is meant by "Early Binding" and "Late Binding"? Which
is better?



What is meant by "Early Binding" and "Late Binding"? Which is better?..

Answer / guest

Early binding and late binding refer to the method used to
bind an interface's properties and methods to an object
reference (variable). Early binding uses type library
information at design time to reference procedures, while
late binding handles this at run time. Late binding
handles this by interrogating the reference before each
call to insure that it supports a particular method. Since
every call to a late bound object actually requires two
calls ("Do you do this?" followed by "Okay, do it then"),
late binding is much less efficient than early binding.
Except where early binding is not supported (ASP,
scripting, etc.), late binding should only be used in very
special cases.

It is a common misconception that any code using the
CreateObject function instead of Set = New is using late
binding. This is not the case. The type declaration of
the object variable determines whether it is late or early
bound, as in the following:

Dim A As Foo
Dim B As Foo
Dim C As Object
Dim D As Object

Set A = New Foo 'Early Bound
Set B = CreateObject("FooLib.Foo") 'Early Bound
Set C = CreateObject("FooLib.Foo") 'Late Bound
Set D = New Foo 'Late Bound

Is This Answer Correct ?    6 Yes 3 No

Post New Answer

More Visual Basic Interview Questions

How to declare Dll Procedure?

1 Answers  


How would you create Visual basic Document file?

0 Answers  


What is a toolbox in visual basic?

0 Answers  


How would you create properties by using class Builder Wizard?

0 Answers  


How does the following statements work? On Error Resume Next

1 Answers  






Difference between DDE and OLE.

0 Answers  


What is the Advantage of ActiveX Dll over Active Exe?

1 Answers  


How do we call MS- Excel in VB?

3 Answers  


How would you attach an ActiveX control in Your Application?

1 Answers  


VB ActiveX: Create a "drivelist"(D1) box, a "folderlistbox"(FLD1) that changes whenever D1 is changed , and a "FilelistBox"(FIL1) that is populated with the file lists under the selected directory in (D1).The file selected is stored in a variable "filename" along with the path. Question: How to use this activeX control in VC++ to get the selected filename?

0 Answers  


Explain the working of templates?

0 Answers  


How would you Create a Query Builder and Explain its uses ?

0 Answers  


Categories