What is the use of template in C++?

Showing Answers 1 - 6 of 6 Answers

baseersd

  • Sep 18th, 2007
 

It makes the program more general.

just take as an example,

If we have written a program to find the binary sort of integers, then we can sort only integers. At some point of time i want to sort character data type. At that time my code may or may not work.

So if we can write a code which is in general sense, then it can be used for any data type.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions