Reputation: 395
I have noticed that, when I create a custom collection class (as explained in this blog)
, the operator "()" becomes automatically available so that it is a synonym to the Item
method.
Are there other forms of operator overloading, implicit or otherwise, available in VBA? And where are those behaviors documented?
Upvotes: 1
Views: 1291
Reputation: 78183
This is not operator overloading, this is marking a property as the default property of an object.
This is a COM feature, and it is merely supported by VB.
When an object that has a default property is used in a non-reference context (without Set
), the value of the default property will be automatically used instead of the object pointer.
See here for more information (also follow the other links from there).
Upvotes: 3