I have simple namespace
, which has one variable and one function. In main
I try to call function without namespace qualifier, and variable with namespace qualifier.
namespace SAM
{
int p = 10;
void fun(int)
{
cout<<"Fun gets called";
}
}
int main()
{
fun(SAM::p);//why SAM::fun is not get called?
return 0;
}
I am not able to call fun, why it is not qualified for ADL (Argument-dependant name lookup)?
I am getting following error in Visual Studio.
'fun': identifier not found
If I use SAM::fun
, it works.