A. Identify the level of the scope B. Identify the class to which the member belongs
C. Define the scope of a member. D. specify the scope.
Scope Symbol: the class name is generally followed by the member name of the class. c ++ is used as an example to prevent different classes from being distinguished by the scope when they have members with the same name.
For example, a and B indicate two classes. both A and B have members member. So
A: Member indicates the member in Class.
B: Member indicates a member of Class B.
Example of a global scope symbol (double colon)
# Include <stdio. h>
Int COUNT = 0; // global variable 0
Void main ()
{
Int COUNT = 10; // local variable 10
Printf ("Count = % d \ n", count); // The local variable shields the global variable, so the output result is 10.
{
Int COUNT = 20;
Printf ("Count = % d \ n",: Count); // The scope symbol indicates that the global variable 0 is referenced.
//: Sort
}
}
Scope identifier: What does it mean when it is used separately? The following code uses OpenGL in MFC
Int npixelformat =: choosepixelformat (m_hdc, & PFD );
: Setpixelformat (m_hdc, npixelformat, & PFD );
M_hrc =: wglcreatecontext (m_hdc );
: Wglmakecurrent (m_hdc, m_hrc );
What are the meanings of the scope delimiters and those without scope delimiters?
(I tried it and didn't find any difference)
Answer:If the namespace NS contains a symbol printf,
There is also a global symbol called printf,
If you use using namespace ns; import the NS symbol, the two printf will conflict. When you only use printf, it will automatically match ns: printf first, so use :: printf refers to the printf in the global symbol.