EXERCISES
  1. What is generic programming? What are its advantages? State some of its applications.
  2. What is function template?
  3. Write a function template to find the smallest elements in an array.
  4. Can function templates be overloaded? How does the compiler select one of the overloaded function?
  5. What is a class template? List the merits and demerits of using a template in ‘C++’.
  6. Distinguish between class templates and function templates.
  7. Write a template function for exchanging (swapping) the values between two variables. Use this function in main() for int, double and char type variables.
  8. Design a function template to perform matrix addition of two given integer matrices, two floating point matrices and double precision matrices separately.
  9. Develop ...

Get Object Oriented Programming with C++, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.