Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
| 25.3 | Fill in the blanks for each of the following:
| |
| 25.4 | Write a namespace, Currency, that defines constant members ONE, TWO, FIVE, TEN, TWENTY, FIFTY and HUNDRED. Write two short programs that use Currency. One program should make all constants available and the other should make only FIVE available. | |
| 25.5 | Given the namespaces in Fig. 25.15, determine whether each statement is true or false. Explain any false answers.
Fig. 25.15. namespaces for Exercise 25.5.
| |
| 25.6 | Compare and contrast mutable and const_cast. Give at least one example of when one might be preferred over the other. [Note: This exercise does not require any code to be written.] | |
| 25.7 | Write a program that uses const_cast to modify a const variable. [Hint: Use a pointer in your solution to point to the const identifier.] | |
| 25.8 | What problem do virtual base classes solve? | |
| 25.9 | Write a program that uses virtual base classes. The class at the top of the hierarchy should provide a constructor that takes at least one argument (i.e., do not provide a default constructor). What challenges does this present for the inheritance hierarchy? | |
| 25.10 | Find the error(s) in each of the following. When possible, explain how to correct each error.
|