Array properties also exist. These are properties that accept an index, just as an array does. Only now the index doesn’t have to be an ordinal type, but can be any type.
A read specifier for an array property is the name method function that has the same return type as the property type. The function must accept as a sole arguent a variable of the same type as the index type. For an array property, one cannot specify fields as read specifiers.
A write specifier for an array property is the name of a method procedure that accepts two arguments: the first argument has the same type as the index, and the second argument is a parameter of the same type as the property type. As an example, see the following declaration:
Then the following statements would be valid:
While the following statements would generate errors:
Because the index types are wrong.