Overloaded Function Calls

The operands are function_name and an optional expression _list. The operator function operator() must be defined as a nonstatic member function. You cannot declare an overloaded function call operator that is a nonmember function.

If you make the following call for the class object x:

x (arg1, arg2, arg3)

it is interpreted as

x.operator()(arg1, arg2, arg3)

Unlike all other overloaded operators, you can provide default arguments and ellipses in the argument list for the function call operator. For example:

class X
{
public:
      X& operator() (int = 5);
};