I am learning C++.
I have learnt basic concept of C++ like class,object. I have trouble learning template class in C++. Anybody will tell me what is a template class in C++.
Why we use this in our program and i have given a template class program here i don't know Why is the namespace used here?
What is template class in c++
Template means a common form for all. In C++ the term is template class. A class contains various types of data variables and functions. A function may have arguments of same or different types. You cannot change the types of these  arguments in the main function. But if you use template class you can change the  types of any arguments in the main function.
From your example you have created a class named Test and a constructor function in it.
T1 and T2 are template variables. Here is a diagram
Â
Â
The constructor function has been called in main function two times with different data types.
Â
Test <float,int> test1(1.23,123);
Test <int,char> test2 (100,'W');
Â
These are valid and will be executed successfully because you have used template class in your program.
Â
And about the statement
Â
using namespace std;
Â
It is a C++ standard library. All classes, functions and templates are declared within the name space named std.
Â
That is why we use this statement.
Â
Hope this helps you.
Â