behavior of const_cast in C++

Viewed 875

Here is my problem, the problem is in comments

const int a = 5;
const_cast<int&>(a)=7; //throw over const attribute in a,and assign to 7
std::cout<<a<<std::endl; //why still out put 5!!!!!!!!!!

Who can tell me why, and some books account these problems to recommend ? Thanks!

3 Answers
Related