Function calls

Once a function has been declared and defined, it can be called from anywhere within the program: from within the main function, from another function, and even from itself. Calling the function involves specifying the function name, followed by the function call operator and any data values the function expects to receive. These values are the arguments for the parameters defined for the function, and the process just described is called passing arguments to the function.

C++ A function may not be called if it has not already been declared.

Passing arguments can be done in two ways:

C++ only

If a class has a destructor or a copy constructor that does more than a bitwise copy, passing a class object by value results in the construction of a temporary object that is actually passed by reference.

It is an error when a function argument is a class object and all of the following properties hold:

End of C++ only

Related information



[ Top of Page | Previous Page | Next Page | Contents | Index ]