What are templates? where we should use it?

Answers were Sorted based on User's Feedback



What are templates? where we should use it?..

Answer / 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

What are templates? where we should use it?..

Answer / 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

More C++ General Interview Questions

Is c better than c++?

0 Answers  


What is the output of printf("%d")?

58 Answers   CTS, HCL, Infosys, TCS, Winit, Wipro,


How can we read/write Structures from/to data files?

0 Answers  


What is a binary file? List the merits and demerits of the binary file usagein C++.

0 Answers  


Write a C/C++ program that connects to a MySQL server and checks if the InnoDB plug-in is installed on it. If so, your program should print the total number of disk writes by MySQL.

4 Answers   Webyog,






find the two largest values among the 6 numbers using control structures : do-while,for,if else,nestedif- else ,while. one or two of them.

0 Answers  


Write about the role of c++ in the tradeoff of safety vs. Usability?

0 Answers  


Why isn't sizeof for a struct equal to the sum of sizeof of each member?

0 Answers  


What is meant by reference variable in C++?

1 Answers  


What are enumerations?

0 Answers  


When do we run a shell in the unix system? How will you tell which shell you are running?

0 Answers  


What is c++ stringstream?

0 Answers  


Categories