(0) and Read = 0
(1) and read = Read
Ten (2) and Read = 0
One (3) and read = Read
(0) and Write = 0
(1) and Write = 0
Ten (2) and write = Write
One (3) and write = Write
Here's how to show the sample code:
Permission definition class (to have an enumeration type) how nice ...)
Class PermissionType
Public Read
Public Write
Public Delete
Private Sub Class_Initialize
Read = 1
Write = 2
Delete = 4
End Sub
End Class
Permission class
Class permissionsetcomponent
Private Intvalue
Public Property Get Read ()
Read = GetValue (permission.read)
End Property
Public Property Let Read (Arg)
Call SetValue (Permission.read, Arg)
End Property
Public Property Get Write ()
Write = GetValue (permission.write)
End Property
Public Property Let Write (Arg)
Call SetValue (Permission.write, Arg)
End Property
Public Property Get Delete ()
Delete = GetValue (permission.delete)
End Property
Public Property Let Delete (Arg)
Call SetValue (Permission.delete, Arg)
End Property
Public Property Get Value ()
Value = Intvalue
End Property
Public Property Let Value (Arg)
Intvalue = arg
End Property
Public Function GetValue (inttype)
GetValue = (Value and inttype) = Inttype
End Function
Public Sub SetValue (inttype, Boolvalue)
IF (boolvalue) Then
Value = value Or inttype
Else
Value = value and (not inttype)
End IF
End Sub
End Class
Use sample code:
Dim Permission:set Permission = new PermissionType
Dim permissionset:set PermissionSet = new Permissionsetcomponent
Permissionset.value = 0
W ("Read:")
Permissionset.read = False
W (Permissionset.value & "" & Permissionset.read)
Permissionset.read = True
W (Permissionset.value & "" & Permissionset.read)
W ("Write:")
Permissionset.write = False
W (Permissionset.value & "" & Permissionset.write)
Permissionset.write = True
W (Permissionset.value & "" & Permissionset.write)
W ("Delete:")
Permissionset.delete = False
W (Permissionset.value & "" & Permissionset.delete)
Permissionset.delete = True
W (Permissionset.value & "" & Permissionset.delete)
Function W (o)
Response.Write ("<br/>" & O)
End Function
Today's lesson is here, we can extrapolate, class ...
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.