-
Notifications
You must be signed in to change notification settings - Fork 0
/
class.vbs
42 lines (36 loc) · 1015 Bytes
/
class.vbs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
Class Car
Public Color
Public Brand
Private InnerModel
Private InnerEngine
'值类型属性
Public Property Get Model()
Model=InnerModel
End Property
Public Property Let Model(Value)
InnerModel=Value
End Property
'对象类型属性
Public Property Set Engine(Value)
Set InnerEngine=Value
End Property
Public Property Get Engine()
Set Engine=InnerEngine
End Property
Private Sub Class_Initialize()
'This event is called when an instance of the class is instantiated
'Initialize properties here and perform other start-up tasks
Color="red"
End Sub
Private Sub Class_Terminate()
'This event is called when a class instance is destroyed
'either explicitly (Set objClassInstance = Nothing) or
'implicitly (it goes out of scope)
End Sub
Public Sub Go()
MsgBox(Color + " "+ InnerModel +" car are go.")
End Sub
End Class
Set myCar = New Car
myCar.Model="8888"
myCar.go