代码之家  ›  专栏  ›  技术社区  ›  Binary Worrier

如何将属性指定为VbScript类的默认属性

  •  3
  • Binary Worrier  · 技术社区  · 15 年前

    既然可以在VB脚本中定义一个类,有没有办法为该类指定一个默认属性?

    e、 g.给定

    Class MyClass
        Private myName 
    
        Public Property Get Name() 
            Name = myName
        End Property
    end class 
    

    Name 是默认属性吗?

    注意:要在VB6中执行此操作,可以向属性添加一个属性,但是

    Public Property Get Name() 
        Attribute Name.VB_MemberFlags = "200"
        Name = strName
    End Property