Method
Operator_Subscript
Description
The subscript operator can now be overloaded by classes. To use it, implement Operator_Subscript in your class.
Sample code
Class OneBasedArray
Sub Constructor(bounds As Integer = 0)
mArray.ResizeTo(bounds - 1)
End Sub
Function Count() As Integer
Return mArray.LastRowIndex + 1
End Function
Sub Operator_ResizeTo(newSize As Integer)
mArray.ResizeTo(newSize - 1)
End Sub
Function Operator_Subscript(index As Integer) As Variant
Return mArray(index - 1)
End Function
Sub Operator_Subscript(index As Integer, Assigns v As Variant)
mArray(index - 1) = v
End Sub
Private mArray() As Variant
End Class
Compatibility
All projects types on all supported operating systems.
See also
Operator Redim, Arrays.ResizeTo statements.