Overloading the Class Member Access Operator ->

From RAD Studio
Jump to: navigation, search

Go Up to Overloading Operator Functions Overview Index


Syntax

postfix-expression -> primary-expression

Description

The expression x->m, where x is a class X object, is interpreted as:

(x.operator->())->m 

so that the function operator ->() must either return a pointer to a class object or return an object of a class for which operator -> is defined.

The operator ->() can only be overloaded as a nonstatic member function.

See Also