Reputation: 51709
Given that one can define a class in VB Script, is there any way to specify a default property for that class?
e.g. Given
Class MyClass
Private myName
Public Property Get Name()
Name = myName
End Property
end class
Is there anyway I can say that Name
is the default property?
NB: To do this in VB6, one would add an attribute to the property, but this doesn't work in VbScript
Public Property Get Name()
Attribute Name.VB_MemberFlags = "200"
Name = strName
End Property
Upvotes: 4
Views: 3004
Reputation: 97540
Use the Default
keyword:
Public Default Property Get Name
Name = myName
End Property
Edit: Here're some tutorial and reference articles about using classes in VBScript, hope you'll find them useful:
VBScript in a Nutshell. Chapter 2: Program Structure (section Class Modules)
Upvotes: 4