11.1.1.1. Exercises: Function Templates

  1. Complete Example 11.2. In particular, write a generic Complex and Fraction class, and fix main() so that it works and uses those classes.

  2. Write a template version of swap(), based on Example 5.13. Write client code to test it thoroughly.

  3. Are there any types for which swap() does not work?

  4. Specify the restrictions on the class parameter in your template swap function.

[ fromfile: templates.xml id: None ]