Is this an unqualified search in C ++?

#include <iostream> namespace X { int k = 8; } int main() { using namespace X; int k = 0; std::cout << k; return 0; } 

I'm struggling to understand the difference between qualified and unqualified searches and how they deal with using namespaces; phrases

I would like to clarify now? Does k invoke the correct search here?

0
source share
1 answer

unqualified name search :

For an unqualified name , which is a name that does not appear to the right of the scope operator: the name search checks as described below until it finds at least one declaration of any kind in which the search stops and further areas are considered.

since k not displayed to the right of the region resolution operator.

+3
source

Source: https://habr.com/ru/post/1274837/


All Articles