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

前端 未结 9 2149
鱼传尺愫
鱼传尺愫 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:26

    :: is used to link something ( a variable, a function, a class, a typedef etc...) to a namespace, or to a class.

    if there is no left hand side before ::, then it underlines the fact you are using the global namespace.

    e.g.:

    ::doMyGlobalFunction();

提交回复
热议问题