A point from ISO draft N3290 :
Unqualified Name Lookup :section 3.4.1, para 14:
If a variable member of a namespace is defined outside of the scope of its
namespace then any name that appears in the definition of the member
(after the declarator-id) is looked up as if the definition of the member
occurred in its namespace.
ex:
namespace N {
int i = 4;
extern int j;
}
int i = 2;
int N::j = i; // N::j == 4
Is there any other possiblitly to prove this point other than using ‘extern’ keyword
can u give some other examples … other than extern
Another example which doesn’t use
externkeyword:Output:
Online demo : http://www.ideone.com/pRVAb