28,408
社区成员




Class CUser
private sUserName'私有字段,只有本类可以用,外面不能访问
'不能访问只能通过字段属性来访问字段,如下:
Public Property Get UserName 用属性,可以对传进来的值进行做些过滤操作
UserName = sUserName
End Property
Public Property Let UserName(Byval Value)
sUserName = Value
End Property
End Class
Class PencilClass
Private recentPencil, recentColor
Property Get Pencil()
Set Pencil = recentPencil
End Property
Property Set Pencil(x)
Set recentPencil = x
End Property
Property Get Pencilcolor()
Select Case recentColor
Case 1: Pencilcolor = "Orange"
Case 2: Pencilcolor = "Green"
Case Else: Pencilcolor = "yellow"
End Select
End Property
Property Let Pencilcolor(x)
If x = "Orange" Then
recentColor = 1
Else
If x = "Green" Then
recentColor = 2
Else
recentColor = 0
End If
End If
End Property
End Class