What are templates? where we should use it?

Answer Posted / prabhatkr09

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 ?    6 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain method of creating object in C++ ?

595


Why namespace is used in c++?

600


Is swift a good first language?

588


What are friend functions in C++?

624


What is name hiding in c++?

613






What is meant by a delegate?

608


Do you know what are pure virtual functions?

640


How does com provide language transparency?

604


Explain how would you handle a situation where you cannot call the destructor of a local explicitly?

539


Write some differences between an external iterator and an internal iterator? Describe the advantage of an external iterator.

609


Write a program using GUI concept for the scheduling algorithms in Operating system like SJF,FCFS etc..

3354


What is virtual table?

619


Can member functions be private?

595


How can we access protected and private members of a class?

589


If a header file is included twice by mistake in the program, will it give any error?

550