16
mc-Module / Re: Indexers How do they work?
« on: October 23, 2016, 07:12:48 pm »
I don't have an example, but maybe this short explanation will help.
In the example on page 56 and 57 there is a FooList that possibly extends the Base List class. In order to act as a List, FooList must implement the behavior of all of the List's functions/methods/subroutines. Lets rename "Foo" to "Car." The integer indexer is pretty simple for CarList, but the string indexer may be complicated. How do you find (index) a Car? By brand, year, model, or color? Your implementation of the signature below will define that.
In the example on page 56 and 57 there is a FooList that possibly extends the Base List class. In order to act as a List, FooList must implement the behavior of all of the List's functions/methods/subroutines. Lets rename "Foo" to "Car." The integer indexer is pretty simple for CarList, but the string indexer may be complicated. How do you find (index) a Car? By brand, year, model, or color? Your implementation of the signature below will define that.
Code: [Select]
Public Function Item(index As String) As Car