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