5.13.  Review Questions

[ fromfile: functions-questions.xml id: functions-questions ]

  1. What is the difference between a function declaration and a function definition?

  2. Why are default argument specifiers in the declaration but not the definition?

  3. Explain why is it an error to have two functions in the same scope with the same signature but with different return types.

  4. For overloading arithmetic symbols (+ - * /) on Fraction objects, which is preferred, member functions or nonmember global operators? Explain your answer.

  5. For overloading left-modifying operators such as = and +=, which is preferred, member function operators or (nonmember) global operators?

  6. Explain the difference between pass-by-value and pass-by-reference. Why would you use one instead of the other?

  7. Explain the difference between preprocessor macros and inline functions.