Private class members
Class scope is everything within the Class...End Class statement. Class members are accessible to all of the properties and methods of the class.
You can refer to an individual member of a class by using its member name.
This example prints the value in a member variable called employeeName$:
Print employeeName$
Within a property or method, you can use the keyword Me to access the class definition. This is particularly useful in Sub New when you are assigning external values to member variables. For example, you can use
Me.memberVariable = externalValue
to assign a value. You can also use Me when you need to:
- Refer to a class member that has the same name as a local variable.
For example, if a property or method contains a local variable X, and X is also the name of a class member, use Me.X within the method to refer to the member X.
- Pass a reference to the class as an argument to a procedure.
You must use Me to access class members that have the same names as LotusScript® keywords.
This class definition example uses Me to refer to a class member that is a keyword.
Class MyObject
' ...
' Reserved keyword Read is used here to name a function.
Function Read
Dim x As Integer ' Status of operation.
' ....
' Me is required to refer to the function named Read.
Me.Read = x%
End Function
' ...
End Class