Given the following code:
struct A
    /*keyword*/ int field;

int main()
    A a;
    const A& b = a;
    b.field = 0;
    return 0;
What access specifier must be in place /*keyword*/ to make the code compile and run successfully?
The keyword mutable before the data field allows you to modify the value of this field, even if it is in a constant object.
The keyword static does not fit, because in this case it is necessary to define A::field outside the class so that the linker knows the memory address at which the value of A::field is stored.

Следи за CodeGalaxy

Мобильное приложение Beta

Get it on Google Play
Обратная Связь
Зарегистрируйся сейчас
или Подпишись на будущие тесты