开发者

Differece between Static and reinerpret cast [duplicate]

This question already has answers here: 开发者_如何学C Closed 11 years ago.

Possible Duplicate:

When should static_cast, dynamic_cast and reinterpret_cast be used?

class b
{
}
class d :public b
{
}

int main
{
 d* d_p = new d();
 b* b_p = static_cast<base*>(d_p);

 b* b_p = reinterpret_cast<base*>(d_p); // any difference will it make
 return 0;
}

So in the above example does static and reinterpret cast make any difference functionaly etc..? for me both are same in this scenario.


Yes, there will be a difference. You should check here

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜