RAD Studio |  |

Overloading The Subscript Operator []
See Also
Collapse All

Syntax

Copy Code

    postfix-expression [ expression ]

Description

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

Example Of Overloading Operators

Overloaded Operators And Inheritance

Overloading Binary Operators

Overloading Operator Functions

Overloading The Assignment Operator =

Overloading The Function Call Operator ( )

Overloading The Class Member Access Operators ->

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!