Public Property Let YearPublished(strYearPublished As String) mstrYearPublished = strYearPublished ' 设置YearPublished属性 End PropertyPublic Property Let YearPublished() as string YearPublished = mstrYearPublished ' 读取YearPublished属性 End Property
YearPublished的值存储在类的成员变量mstrYearPublished中
类的属性是类的一个数据成员。 可以这样写: 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 过程增加属性过程的目的主要是为了区分读写,并可以在过程内判断。
mstrYearPublished = strYearPublished ' 设置YearPublished属性
End PropertyPublic Property Let YearPublished() as string
YearPublished = mstrYearPublished ' 读取YearPublished属性
End Property
可以这样写:
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 过程增加属性过程的目的主要是为了区分读写,并可以在过程内判断。