
Long questions with answers for this topic
A template lets us write code once and use it for multiple data types (generic programming).
A function template is a generic function that works for different data types.
A class template is a generic class that can be instantiated for different types.
An exception is an abnormal runtime event that disrupts normal program flow.
try, throw, catch.
Catch-all is written as catch(...).
Templates support generic programming by allowing the same function/class to work for different data types. Advantages (any three):
Hence templates are widely used in C++ libraries.
Sign in to access the all questions and answers
It's free and takes just 5 seconds