1. Colon (:) usage
(1) Represents the definition of a bit field within a mechanism (that is, the variable occupies several bit spaces)
typedef struct _xxx{
unsigned char a:4;
unsigned char c;
} ; Xxx
(2) The colon at the back of the constructor functions as a method of assigning a value to a member variable, initializing the list, and more appropriate for the const type of the member variable.
struct _xxx{
_xxx (): Y (0xc0) {}
};
(3) Public: and private: The following colon, which indicates that all the members defined later are publicly or privately held until the next "common:" or "Private:" appears. "Private:" is handled by default.
(4) The class name followed by a colon is used to define the inheritance of the class.
Class derived class Name: Inheritance mode base class name
{
Members of derived classes
};
Inheritance mode: Public, private, and protected, default processing is public.
The role of a colon (:) in C + +