reference data member in const object remains modifiable unlike non-reference data members

前端 未结 0 1562
不知归路
不知归路 2021-01-30 15:06

Why is it that reference data members seem to escape the constness of their encapsulating objects?

struct A {
    int &i;
    int j;
};

int i = 0;
const A a{         


        
相关标签:
回答
  • 消灭零回复
提交回复
热议问题