What are templates? where we should use it?

Answer Posted / satheeshkumar

Template allow us to write one function and class that
works for different datatype .

Use :

Create a type safe collection class that can operate on
data of any type.

add extra type checking for function.

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is a local variable?

582


What are the 4 types of library?

602


Can we use pointers in c++?

620


Are c and c++ different?

548


Can a new be used in place of old mallocq? If yes, why?

641






Is c++ a good first language to learn?

582


Is it legal in c++ to overload operator++ so that it decrements a value in your class?

616


What is the word you will use when defining a function in base class to allow this function to be a polimorphic function?

676


Explain the static storage classes in c++.

709


What does ios :: app do in c++?

557


Can we delete this pointer in c++?

686


Which recursive sorting technique always makes recursive calls to sort subarrays that are about half size of the original array?

616


What is the purpose of templates in c++?

571


What gives the current position of the put pointer?

568


What is the difference between function overloading and operator overloading?

579