Show: Object Pascal C++
Display Preferences

Overloading The Function Call Operator ( )

From Appmethod Topics
Jump to: navigation, search

Go Up to Overloading Operator Functions Overview Index

Syntax

postfix-expression ( <expression-list> )

Description

In its ordinary use as a function call, the postfix-expression must be a function name, or a pointer or reference to a function. When the postfix-expression is used to make a member function call, postfix-expression must be a class member function name or a pointer-to-member expression used to select a class member function. In either case, the postfix-expression is followed by the optional expression-list.

A call X(arg1, arg2), where X is an object class X, is interpreted as X.operator()(arg1, arg2).

The function call operator, operator()(), can only be overloaded as a nonstatic member function.

See Also

Personal tools
In other languages