Binary Worrier
Binary Worrier

Reputation: 51709

How to designate a property as the Default Property for a VbScript class

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

Answers (1)

Helen
Helen

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:

Upvotes: 4

Related Questions