1
2
3
4
5
6
7
8
9
10
11
#include <iostream>
int main() {
const int* ptr = new int(10);
int* mutable_ptr = const_cast<int*>(ptr);
*mutable_ptr = 20; // Modifying the value
std::cout << "Value: " << *ptr << std::endl;
delete ptr;
return 0;
}
Back to constant_cast