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
2009-08-17 12:30:20
Downvoter, please explain?
AnthonyWJones
2009-09-01 12:24:03
+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
2009-08-17 12:30:46
A:
You can set a default property/method in a user-defiend class, but not for the existing classes for the reasons stated above.
Sarkazein
2009-08-17 15:27:22