Const syntax

xiaoxiao2021-03-05  22

1 For the general constant, const is the same as the previous or back of the type specifier. Eg: const I = 9; int Const i = 9; 2 When using the const modifier, it will be different due to the difference between the Const position. EG: char * const p = str1; p is a constant pointer, and P is pointed to not change, and * p can be updated, that is, the statement P = STR2 illegal, statement * p = "c" correct. const char * p = str1; P is a string constant pointer, and the point P pointing STR1 is unrecognizable, and P can be updated, the statement * p = "x" illegally, the statement P = STR2 is legal. Const can also be used to modify the reference, the referenced object cannot be Updated; often pointers, often references are often used for functions, such parameters are called normal parameters. 3 Member functions do not use constrains unable to operate the normal object; format: () Const; 4 Member of the Data ...

转载请注明原文地址:https://www.9cbs.com/read-32312.html

New Post(0)