类的属性就是用来描述类的特征,举例如下:
   建立一个叫Person的类,它有以下属性:Name,Sex,Age等等。当这个类被实例化,它的属性都被赋上值时,你就可以通过这些属性,了解到这个人的特征。

解决方案 »

  1.   

    Public Property Let YearPublished(strYearPublished As String)
        mstrYearPublished = strYearPublished   ' 设置YearPublished属性
    End PropertyPublic Property Let YearPublished() as string
        YearPublished = mstrYearPublished      ' 读取YearPublished属性
    End Property
      

  2.   

    YearPublished的值存储在类的成员变量mstrYearPublished中
      

  3.   

    类的属性是类的一个数据成员。
    可以这样写:
    public Name as string
    在类的外部就可以直接这样用:
    yourclass.Name="Ljren_t"
    dim Name as string
    Name= yourclass.Name还可以在类中这样写:
    dim mvarName as string property let Name (byval vData as string)
        mvarName= vdata      
    end property property get Name() as string
       Name= mvarName
    end property 在类的外部使用:
    yourclass.Name="Ljren_t" '调用preperty let过程
    dim Name as string        
    Name= yourclass.Name      '调用property Get 过程增加属性过程的目的主要是为了区分读写,并可以在过程内判断。