Overloading The Subscript Operator

From RAD Studio
Jump to: navigation, search

Go Up to Overloading Operator Functions Overview Index (C++)


postfix-expression [ expression ]


The corresponding operator function is operator[](). This can be user-defined for a class X (and any derived classes). The expression X[y], where X is an object of class X, is interpreted as x.operator[](y).

The operator[]() can only be overloaded as a nonstatic member function.

See Also