Evo. G Tech Team Forum
Welcome to Evo. G Tech Team Forum. We have moved to a new website : www.evogtechteam.com

Thanks you.

by Evo. G Tech Team Management.


View previous topic View next topic Go down


Post by too wei on June 23rd 2015, 18:29


如果你试图使用一个 const_cast 以外的新风格强制转型来代替const_cast,你的代码将无法编译。

int main()
const int * cp = new int; //const
*cp = 50; //error

int * p = const_cast(cp); //const_cast把cp转换去non-const
*p = 50; //ok!

const int * temp  = const_cast(p); //const_cast又把p转回去const
*temp = 60; //error

return 0;

too wei

Posts : 31
Points : 20271
Reputation : 0
Join date : 2015-04-21
Age : 19
Location : Johor

View user profile

Back to top Go down

View previous topic View next topic Back to top

Permissions in this forum:
You cannot reply to topics in this forum