August 2001
Beginner
482 pages
10h 52m
English
| Q1: | Why would you ever use default values when you can overload a function? |
| A1: | It is easier to maintain one function than two, and often easier to understand a function with default parameters than to study the bodies of two functions. Furthermore, updating one of the functions and neglecting to update the second is a common source of bugs. |
| Q2: | Given the problems with overloaded functions, why not always use default values instead? |
| A2: | Overloaded functions supply capabilities not available with default variables, such as varying the list of parameters by type rather than just by number. |
| Q3: | When writing a class constructor, how do you decide what to put in the initialization and what to put in the body of the constructor? |
| A3: | A simple rule of ... |
Read now
Unlock full access