指向常量的指针(pointer to const)
const修饰的是int,说明int是常量不可修改,不能通过指针修改他的值,但可以指向别处- 指针指向的对象可以不是
const,但是还是不能用指针去修改他,可以用其他方法修改 - 必须用
const void*才能指向const对象 
const int* pInteger;    // int const* pInteger;
int num = 10;           // 不是const
pInteger = #
// *pInteger = 100;	// error, 不能用指针修改常量
num = 20;               // yes,可以用其他方法修改
int another = 100;
pInteger = &another;    // yes,可以改变指针指向
const char ch = 'a';
// void* p = &ch;   //error
const void* p = &ch;
所谓指向常量的指针或引用,不过是指针或引用“自以为是”罢了,它们觉得自己指向了常量,所以自觉地不去改变所指对象的值
常量指针(const pointer)
const在*右边,修饰的是指针,说明指针是常量,所以他存储的地址不能变,也就是不能改变指向,可以通过指针改变指向对象的值- 常量指针必须进行初始化
 - 常量指针不能指向
const变量,只能用指向常量的指针指向const变量 
int num = 10;
// const int num = 10;  // error,const int* -> int*
int* const pInt = # 
int another = 100;
// pInt = &another;     // error, 常指针不能修改指向
*pInt = 100;            // yes,变量不是const,可以改变他的值
用名词顶层const表示指针本身是个常量,而用名词底层const表示指针所指对象是一个常量
指针大小
int main(int argc, char const *argv[]){
    cout << sizeof(int) << endl;    // 4
    cout << sizeof(char) << endl;   // 1
    
    cout << sizeof(int*) << endl;   // 8
    cout << sizeof(char*) << endl;  // 8
    return 0;
}
可见不管是什么类型的指针,大小都是8个字节(64位机器)
类中使用const
使用const关键字进行说明的成员函数,称为常成员函数。只有常成员函数才有资格操作常量或常对象,没有使用const关键字进行说明的成员函数不能用来操作常对象。
对于类中的
const成员变量必须通过初始化列表进行初始化
class Apple {
public:
    Apple(int n): num(n) {}
    static const int num = 10;
};
int main(int argc, char const *argv[]) {
    Apple a;
    cout << a.num << endl;
    cout << Apple::num << endl;
    return 0;
}
static可以和const结合
本来static成员必须在类内声明,在类外初始化
class Apple {
public:
    Apple() {}
    static int num;   // 声明
};
int Apple::num = 10;  // 定义
加上const就可以在类内初始化了,当然也可以在类外初始化
class Apple {
public:
    Apple() {}
    // static const int num = 10;   // 直接在类内初始化
    static const int num;   // 声明
};
const int Apple::num = 10;  // 定义