langs a-z
This commit is contained in:
parent
db842d013d
commit
d066446780
11389 changed files with 98361 additions and 1020 deletions
31
Task/Classes/VBA/classes-1.vba
Normal file
31
Task/Classes/VBA/classes-1.vba
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
Private Const m_default = 10
|
||||
Private m_bar As Integer
|
||||
|
||||
Private Sub Class_Initialize()
|
||||
'constructor, can be used to set default values
|
||||
m_bar = m_default
|
||||
End Sub
|
||||
|
||||
Private Sub Class_Terminate()
|
||||
'destructor, can be used to do some cleaning up
|
||||
'here we just print a message
|
||||
Debug.Print "---object destroyed---"
|
||||
End Sub
|
||||
Property Let Bar(value As Integer)
|
||||
m_bar = value
|
||||
End Property
|
||||
|
||||
Property Get Bar() As Integer
|
||||
Bar = m_bar
|
||||
End Property
|
||||
|
||||
Function DoubleBar()
|
||||
m_bar = m_bar * 2
|
||||
End Function
|
||||
|
||||
Function MultiplyBar(x As Integer)
|
||||
'another method
|
||||
MultiplyBar = m_bar * x
|
||||
'Note: instead of using the instance variable m_bar we could refer to the Bar property of this object using the special word "Me":
|
||||
' MultiplyBar = Me.Bar * x
|
||||
End Function
|
||||
Loading…
Add table
Add a link
Reference in a new issue