Hello Phil.
Yes, I made the first example just to clarify what you said, I did not want to imply that you were not correct. I just thought to be more clear about the fact al the late bind is done internally by
VB using the Object keyword.
Regarding Implements I could have been misleading as well :) Pardon my English.
If CManager implements CPerson, and Name is a method of CPerson, there are many ways to call Name of the CManager class:
dim cm as CManger
cm.Name <- early binding
dim cm a Object
cm.Name <- late binding
dim cp as CPerson
CallByName(cp, "Name", vbget) <- late bind
dim cp as CPerson
set cp = SomeCManagerClass
cp.Name <- early binding
My point (that was not clear) is that in
VB it is still possible to have early binding even though the class is not known at design time, if that class implements a known interface.
For example, a firm keeps a collection of people entered in the building, each of them can be a CManager, CThirdFloor, CPersonel, CStaff, CGuest and so on. To print all names I can do:
dim cp as Object
for each cp in FirmCollection
debug.print cp.Name <- late bind
or, if all the classes implement CPerson
dim cp as CPerson
for each cp in FirmCollection
debug.print cp.Name
The second case is early bind.
And yes, Implements is (like you said) the backdoor to add (a sort of) polymorphism to
VB.
Hope that I was more clear this time...
ciao,
Marco