权限放大不被允许,但是权限平移和权限缩小是被允许的
权限放大:
const int c = 20;
int& d = c;
权限平移:
//1.
int a = 10;
int& b = a;
//2.
const int c = 20;
const int& d = c;
权限缩小:
int a = 10;
const int& e = a;
权限放大不被允许,但是权限平移和权限缩小是被允许的
权限放大:
const int c = 20;
int& d = c;
权限平移:
//1.
int a = 10;
int& b = a;
//2.
const int c = 20;
const int& d = c;
权限缩小:
int a = 10;
const int& e = a;