Answers for "Write short notes on Templates in C++"

C++
1

template in c++

template <typename T>
void Swap(T &n1, T &n2)
{
	T temp;
	temp = n1;
	n1 = n2;
	n2 = temp;
}
Posted by: Guest on October-29-2020
1

template in c++

// template function
template <class T>
T Large(T n1, T n2)
{
	return (n1 > n2) ? n1 : n2;
}
Posted by: Guest on October-29-2020

Browse Popular Code Answers by Language