What is the meaning of prepended double colon “::”?

前端 未结 9 2156
鱼传尺愫
鱼传尺愫 2020-11-22 15:54

I found this line of a code in a class which I have to modify:

::Configuration * tmpCo = m_configurationDB;//pointer to current db

and I do

9条回答
  •  清歌不尽
    2020-11-22 16:31

    :: is a operator of defining the namespace.

    For example, if you want to use cout without mentioning using namespace std; in your code you write this:

    std::cout << "test";
    

    When no namespace is mentioned, that it is said that class belongs to global namespace.

提交回复
热议问题