6.22. Wrap-Up

In this chapter, you learned more about function declarations, including function prototypes, function signatures, function headers and function bodies. We overviewed the math library functions. You learned about argument coercion, or the forcing of arguments to the appropriate types specified by the parameter declarations of a function. We demonstrated how to generate random numbers and use them in a game-playing application. We showed how to define sets of constants with enums. You also learned about the scope of variables, storage-class specifiers and storage duration. Two different ways to pass arguments to functions were covered—pass-by-value and pass-by-reference. For pass-by-reference, references are used as an alias to a variable. We showed how to implement inline functions and functions that receive default arguments. You learned that multiple functions in one class can be overloaded by providing functions with the same name and different signatures. Such functions can be used to perform the same or similar tasks, using different types or different numbers of parameters. We demonstrated a simpler way of overloading functions using function templates, where a function is defined once but can be used for several different types. We discussed recursion, where a function calls itself, either directly or indirectly through another function, to solve a problem.

In Chapter 7, you’ll learn how to maintain lists and tables of data in array and vector objects. You’ll see enhanced versions of the GradeBook class that use arrays to store the actual grades entered.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.22.77.149