tags:

views:

298

answers:

3

In Visual Basic 6, it is possible to define a method/property as "default". When this is applied to a class, and a class instance is used, certain assignments use the default property/method defined on that class implicitly. However, it is also possible to apply default to a property/method that is housed in a module. What would this achieve? How would it be possible to use an implicit method/property call that is housed in a module?

+1  A: 

No its not possible. The Default property is achieved by using a DispID of 0 on a member of an interface. Since Modules do not implement interfaces its not possible to indicate that function in a module is a "Default".

Why would you want to do this in a module anyway?

AnthonyWJones
Downvoter, please explain?
AnthonyWJones
+2  A: 

Like you, I don't see how it can have any effect. You can also set methods in modules as AboutBox or Refresh, which surely can't mean anything? I think it's probably an oversight that you can set the procedure ID (DispID) for methods and properties in standard BAS modules.

MarkJ
A: 

You can set a default property/method in a user-defiend class, but not for the existing classes for the reasons stated above.

Setting a default property in a user-defined class

Sarkazein