help in teaching templates in c++

hello it's rizwan from bhavnagar studying in tybca . i want to learn how to create templates in c++ . please help me out by giving a small example.
[152 byte] By [vasayarizwan] at [2007-11-20 11:21:09]
# 1 Re: help in teaching templates in c++
[ Moved Thread ]
Ejaz at 2007-11-9 1:25:23 >
# 2 Re: help in teaching templates in c++
Here is a thread ( http://www.dev-archive.com/forum/showthread.php?t=401762) discussing books for beginners. I would recommend you get one and use the forum to discuss things you don't understand.
treuss at 2007-11-9 1:26:24 >
# 3 Re: help in teaching templates in c++
Search the sticky, there is template work examples there.

Here is a very quick example:
template <typename T>
T func(T number)
{
T templateItem;
templateItem = number + 10;
return templateItem;
}

int main()
{
int i1 = 5;
double d1 = 5.0;

int i2 = func(i1); // i2 becomes 15 using T as an int
double d2 = func(d1); // d2 becomes 15.0 using T as a double
}
mcmancsu at 2007-11-9 1:27:34 >