Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - What does:: mean in c++ language?
What does:: mean in c++ language?
Range operator

As the name implies, it is the scope of a variable or function. What is scope?

for(int I = 0; I< 10; i++)

{

int num = 5;

}

The scope of num here is only valid in for. It is not valid outside of.

Namespace mynum

{

int num = 22

}

The variable num = 22 is defined in the namespace mynum. To access this variable, you need to use range characters.

mynum::num = 5; This is possible if num=5 is direct; It's not good.

Another example.

OB class

{

public:void AppEnd(){ int I = 6; }

}

Sor: public OB

{

public:void AppEnd(){ int I = 5; }

}

Subclass AppEnd function, the base class also has it. Use subclass object sor _ so_ so. AppEnd(); If you want to call the integrated AppEnd function instead of the subclass's own, then _so. OB::AppEnd();