+ 2
Syntax for "class Template and function template"?
3 odpowiedzi
+ 2
For class and function -
template <class T>;
But in class in main() you have to declare datatype of class
main()
{
BCA <datatype> obj;
...
}
+ 1
and what about the function template?? himanshu??
+ 1
Here an example :
template <class T>
incre(T &x)
{T w;
w=x++;
cout<<w;
}
int main()
{
int y; float z;
incre(y);
incre(z);
return 0;
}