Private Arr() As Integer
Sub Class_Initialize()
Redim Arr(0 To 3)
End Sub
Property Let Buf(Idx As Integer, Val As Integer)
Arr(Idx Mod 4) = Val
End Property
Property Get Buf(Idx As Integer) As Integer
Buf = Arr(Idx Mod 4)
End Property
What does the following client code print?
Dim B as CircularBuffer
Set B = New CircularBuffer
B.Buf(0) = 10: B.Buf(1) = 11: B.Buf(2) = 12: B.Buf(3) = 13: B.Buf(4) = 14
Debug.Print B.Buf(0)
Debug.Print B.Buf(5)