const函数声明
- 修饰成员函数,不会改变成员变量:
- a function b const (c){}: in member function means, all member properties in the function cannot be modified.
2.修饰形参,输入参数在函数中不会被更改,提高程序的健壮性:
- a function b (const c){}: the parameter c cannot be modified in the function
- 修饰返回值,返回值不能修改,尤其用在返回值是指针类型的时候:
- const a function b (c){}: the return value a cannot be modified in the function