Review --C ++ data types (1)

A, const usage

       const defaults to the local variables of the file, but the scope of non-const variables of global scope is global;

       However, if the const preceded ertern, it can be specified as a global variable.

Second, the reference

       Alias variable is referenced, commonly used function "parameter list" , the reference for transfer to do, and can modify arguments.

Third, the type definition (typedef)

       Format: typedef prompt data type ; for example: typedef int Myint; after this type can declare int: myint a = 1;

       Objective: to use the type of object can be emphasized; simplify complex type definition;

       Class may also be used, struct structure:

typedef struct _ccArray
{
      ****
}ccArray;

Fourth, the enumeration

       With the enum keyword to define enumeration constants: enum optional enumeration type enum {name list of members}; Eume the TIME {hour, minute, SECOND,};

       Enumeration members are constants, default 0, 0,1,2 .... can also be assigned, if the first assignment 2, then later became 3,4,5 ...;

V. custom class

       When designing a class, an interface, designed to achieve the class-based redesign;

       this is a reference to the current object;

       

    

 

Guess you like

Origin www.cnblogs.com/jiang-021/p/11519197.html