LotusScript 是否有 this 或 self 的等价物?
Does LotusScript have an equivalent of this or self?
我正在尝试在 Lotus Notes 中创建一个对象并在 OOP 庄园中工作。 Lotus 脚本只希望我能够做到这一点。
我很难找到的一件事是莲花脚本中的 类 是否有任何关于它们自己的概念。在C#中可以使用"this"关键字,python有self的概念。 Lotus Script有类似的概念吗?
LotusScript 有关键字 Me
来引用当前的 class 实例。
来自 IBM 的 example code for the class construct,您可以在 InvertColors()
方法的最后两行看到 Me 引用。
' Define a class.
Class textObject
' Declare member variables.
backGroundColor As Integer
textColor As Integer
contentString As String
' Define constructor sub.
Sub New (bColor As Integer, tColor As Integer, _
cString As String)
backGroundColor% = bColor%
textColor% = tColor%
contentString$ = cString$
End Sub
' Define destructor sub.
Sub Delete
Print "Deleting text object."
End Sub
' Define a sub to invert background and text colors.
Sub InvertColors
Dim x As Integer, y As Integer
x% = backGroundColor%
y% = textColor%
Me.backGroundColor% = y%
Me.textColor% = x%
End Sub
End Class
我正在尝试在 Lotus Notes 中创建一个对象并在 OOP 庄园中工作。 Lotus 脚本只希望我能够做到这一点。
我很难找到的一件事是莲花脚本中的 类 是否有任何关于它们自己的概念。在C#中可以使用"this"关键字,python有self的概念。 Lotus Script有类似的概念吗?
LotusScript 有关键字 Me
来引用当前的 class 实例。
来自 IBM 的 example code for the class construct,您可以在 InvertColors()
方法的最后两行看到 Me 引用。
' Define a class.
Class textObject
' Declare member variables.
backGroundColor As Integer
textColor As Integer
contentString As String
' Define constructor sub.
Sub New (bColor As Integer, tColor As Integer, _
cString As String)
backGroundColor% = bColor%
textColor% = tColor%
contentString$ = cString$
End Sub
' Define destructor sub.
Sub Delete
Print "Deleting text object."
End Sub
' Define a sub to invert background and text colors.
Sub InvertColors
Dim x As Integer, y As Integer
x% = backGroundColor%
y% = textColor%
Me.backGroundColor% = y%
Me.textColor% = x%
End Sub
End Class