![]() |
|
C++ Function templates are those functions which can handle different data types without separate code for each of them. For a similar operation on several kinds of data types, a programmer need not write different versions by overloading a function. It is enough if he writes a C++ template based function. This will take care of all the data types. There are two types of templates in C++, viz., function templates and class templates. Business - Click the link on the left to visit our partner sites under business/finance/loan/mortgage category Computers - Click the link on the left to visit our partner sites under computer hardware/software/peripheral category Internet - Click the link on the left to visit our partner sites under webhosting/webdesign/internet marketing category Software - Click the link on the left to visit our partner sites under software category Web Design - Click the link on the left to visit our partner sites under web design/development category Web Hosting - Click the link on the left to visit our partner sites under web hosting category Web Promotion - Click the link on the left to visit our partner sites under search engine optimization/internet marketing category Web Resources - Click the link on the left to visit our partner sites under other web category Recreation - Click the link on the left to visit our partner sites under travel/hotel/cruise category Casino - Click the link on the left to visit our partner sites under online gambling/poker/blackjack/roulette category Health - Click the link on the left to visit our partner sites under online pharmacy/hospital/health category Shopping - Click the link on the left to visit our partner sites under online shopping/gift category Miscellaneous - Click the link on the left to visit our partner sites under all other categories C++ templates come to our rescue in such situations. When we use C++ function templates, only one function signature needs to be created. The C++ compiler will automatically generate the required functions for handling the individual data types. This is how a programmer's life is made a lot easier. This c++ function template definition will be enough. Now when the integer version of the function, the compiler generates an Add function compatible for integer data type and if float is called it generates float type and so on. |
| © Copyright 2006, databinary.com |