- 博客(2)
- 资源 (5)
- 收藏
- 关注
原创 C++四种强制类型转换
ANSI-C++标准定义了四个新的转换符:'reinterpret_cast', 'static_cast', 'dynamic_cast' 和 'const_cast',目的在于控制类(class)之间的类型转换。代码:reinterpret_cast(expression)dynamic_cast(expression)static_cast(expression)const_
2014-12-16 22:44:37 490
原创 const在变量前后,函数后的含义(C++)
int me; const int * p1=&me;//p1可变,*p1不可变,此时不能用*p1来修改,但是p1可以转向 int * const p2=&me;//p2不可变,*p2可变,此时允许*p2来修改其值,但是p2不能转向。 const int *const p3=&me;//p3不可变,*p3也不可变,此时既不能用*p3来修改其值,也不能转向 const 放在函
2014-12-16 21:16:52 2026
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人