Let\'s start with this demo
#include
using namespace std;
template
void abs(T number)
{
if (number < 0)
numbe
Introduce your own namespace
#include
#include // just for testing ADL of 'abs'
namespace ns // introduce namespace
{
template
void abs(T number)
{
if (number < 0)
{
number = -number;
}
std::cout << "The absolute value of the number is " << number << std::endl;
}
}
int main()
{
int num1 = 1;
int num2 = 2;
double num3 = -2.1333;
float num4 = -4.23f;
using ns::abs; // use abs from the namespace just introduced above
abs(num1);
abs(num2);
abs(num3);
abs(num4);
return 0;
}