5.1.1. Exercises: Overloading Functions

  1. Experiment with Example 5.1. Start by uncommenting the third member function and compiling.

  2. Try uncommenting the following line just before the end of main():

       //  csd.demo(4.5);  
       

    What happened? Explain the error message.

  3. Notice the compiler warnings about unused parameters when you build this application. Try deleting all the unused parameter names from the function heads that the compiler mentions. (Do not delete the parameter types!) Then rebuild the application and observe the compiler output. This is a good way to notify the compiler that you do not intend to use certain parameters. You can see this technique used in a more convincing way in Section 15.2.

  4. Add other function calls and other variations on the demo() function.

    Explain each result.

[ fromfile: functions.xml id: None ]