Indexer (programming)

The expression a[b...] translates to a call to the user-defined function operator[] as (a).operator[](b...).

They are similar to properties, but differ by not being static, and the fact that indexers' accessors take parameters.

The get and set accessors are called as methods using the parameter list of the indexer declaration, but the set accessor still has the implicit value parameter.

The output of the code is: In PHP indexing can be implemented via the predefined ArrayAccess interface,[4] In Python one implements indexing by overloading the __getitem__ and __setitem__ methods, Rust provides the std::ops::Index trait.

[5] In Smalltalk one can emulate indexing by (e.g.) defining the get: and set:value: instance methods.