(1) denotes the definition of an institution's inner-field (that is, the variable takes up several bit spaces)
Copy Code code as follows:
typedef struct _xxx{
unsigned char a:4;
unsigned char c;
} ; Xxx
(2) The colon at the back of the constructor splits, the method that the class assigns to the member variable, initializes the list, and is more applicable to the constant const type of the member variable.
Copy Code code as follows:
struct _xxx{
_xxx (): Y (0xc0) {}
};
(3) Public: and private: The following colon, which means that all the members that are defined later are publicly or privately owned, until the next, or private:, appears. "Private:" for default processing.
(4) After the class name colon is used to define the inheritance of the class.
Copy Code code as follows:
Class derived class Name: Inheritance method base class name
{
Members of derived classes
};
Inheritance: Public, private, and protected, and default processing is public.
2. Double colon (::) usage
(1) denotes "field operator"
Example: Declares a Class A, Class A declares a member function void F (), but does not give the definition of F in the declaration of the class, then the f is defined outside the class.
It is written as a void A::f (), which means that the F () function is a member function of class A.
(2) Directly before the global function, the expression is a global function
For example: In VC, you can call API functions in the API function name before adding::
(3) refers to reference member functions and variables, the scope member operator
Example: System::math::sqrt () is equivalent to SYSTEM.MATH.SQRT ()
VC in the following
:: Is the "scope decomposition operator" in C + +. For example, declaring a Class A, Class A declares a member function VOIDF (), but does not give the definition of F in the declaration of the class, then the definition of f in the class is written as Voida::f (), which means that the F () function is a member function of Class A.
:: There is generally a use, is directly used in the global function before, the expression is a global function. When a member function of a class has the same name as a global function outside of a class, the test, when the big hint is defined within the class, calls the function name by default as its own member functions; If you want to invoke a global function of the same name, you must hit:: To make a difference. For example, in VC, you can call API functions in the API function name before adding::.