const_cast Demo : const cast « Development « C++
- C++
- Development
- const cast
const_cast Demo

#include <iostream>
using namespace std;
void f(const double &i)
{
double &v = const_cast<double &> (i);
v = 100.0;
}
int main()
{
double x = 98.6;
cout << x << endl;
f(x);
cout << x << endl;
return 0;
}
Related examples in the same category