17.9 Example: Overloading the Subscript
Operator
Implementation of a "safe array":
- The subscript operator checks that index is valid
- First (non-const) version returns a reference, an L-value
- The second version is const, returns a copy
prev
|top
|next