Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void foo(const int*x, int*y)
- {
- cout << *x << *y << '\n'; // 0 0
- *y = 2;
- cout << *x << *y << '\n; // 2 2
- *const_cast<int*>(x) = 3
- cout << *x << *y << '\n' // 4 4
- }
- struct S {
- int x;
- int *y;
- };
- const S cs;
- cs.x = 0; // ошибка
- cs->y = 1; // ok
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement