Consider This Code
namespace apple {
namespace {
int a=10;
int b=10;
}
int a=20;
}
int main()
{
cout<<apple::b; //prints 10
cout<<apple::a; // prints 20
}
unnamed namespace "variable a"
is always hidden. How to access "variable a"
of unnamed namespace.
Is it even legal to declare unnamed namespaces inside named namespaces?
Aucun commentaire:
Enregistrer un commentaire