C++ self-learning notes(6)

static_cast and reinterpret_cast are conversion types :

static_cast can perform conversions betwenn pointers and related classes. The command goes as: static_cast<new_type>(expression) . An example is shown below:

205815_BU7Q_2968040.png

result:

205912_yq57_2968040.png

 

reinterpret_cast can convert between completely unrelated pointer types. See the example below:

 

212647_r8xR_2968040.png

result:

212736_ni25_2968040.png

 

Check more information about type conversion from the link below.

Useful links:

http://blog.csdn.net/jofranks/article/details/7828331

http://www.cnblogs.com/ider/archive/2011/07/31/cpp_cast_operator_part4.html

http://www.cnblogs.com/ider/archive/2011/07/30/cpp_cast_operator_part3.html

http://blog.csdn.net/zhuichao001/article/details/7924148

http://blog.csdn.net/querw/article/details/7387594

http://blog.csdn.net/jofranks/article/details/7828339

http://www.cplusplus.com/doc/tutorial/typecasting/

 

to be continued...

转载于:https://my.oschina.net/u/2968040/blog/995747

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值