Self-Review Exercises

  1. 18.1 State which of the following are true and which are false. If false, explain why.

    1. Keywords typename and class as used with a template type parameter specifically mean “any user-defined class type.”

    2. A function template can be overloaded by another function template with the same function name.

    3. Template parameter names among template definitions must be unique.

    4. Each member-function definition outside its corresponding class template definition must begin with template and the same template parameters as its class template.

  2. 18.2 Fill in the blanks in each of the following:

    1. Templates enable us to specify, with a single code segment, an entire range of related functions called          , or an entire range of related classes called          .

    2. All template definitions begin with the keyword          , followed by a list of template parameters enclosed in          .

    3. The related functions generated from a function template all have the same name, so the compiler uses           resolution to invoke the proper function.

    4. Class templates also are called           types.

    5. The           operator is used with a class-template name to tie each member-function definition to the class template’s scope.

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

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