Operator Redim
From Xojo Documentation
Method
The Redim statement can be overloaded by a class. To use it, implement Operator_Redim in your class. It makes the Redim statement available for objects that were not declared as arrays.
Sample Code
Class OneBasedArray
Sub Constructor(bounds As Integer = 0)
Redim mArray(bounds - 1)
End Sub
Function Count() As Integer
Return mArray.Ubound + 1
End Function
Sub Operator_Redim(newSize As Integer)
Redim mArray(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
Sub Constructor(bounds As Integer = 0)
Redim mArray(bounds - 1)
End Sub
Function Count() As Integer
Return mArray.Ubound + 1
End Function
Sub Operator_Redim(newSize As Integer)
Redim mArray(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
See Also
Operator Overloading, Operator_Subscript, Redim statements.