4.5. Summary

  1. Like Python, C++ supports the use of functions.
  2. In C++, a function definition requires a name, a group of parameters, a return type, and a body.
  3. Non-fruitful functions in C++ must contain the keyword void in its function definition.
  4. You can pass variables by value as well as by reference in C++ functions. Passing by reference utilizes the use of pointers.
  5. Pass by reference is useful when you require a function to return multiple variables.
  6. To pass an array to a function you need to use an array parameter. The array parameter is denoted by the array variable name followed by set of square brackets ([ and ]).
  7. Defining a new meaning for an already existing operator (such as the arithmetic operators plus “+” or times “*”) is called overloading the operator.
  8. The operators ::, #, ., and ? are reserved and cannot be overloaded.
  9. Some operators such as =, [], () and -> can only be overloaded as member functions of a class and not as global functions.
Next Section - 4.6. Glossary