Answer the question
In order to leave comments, you need to log in
Why is it possible to call a non-constant method through a constant reference (spoiler - you can’t, inattention)?
class S {
char array[17] ;
public:
void f(void) { ; }
void fc(void) const { ; }
} ;
int main (void) {
S s;
const S& rc = s;
s.f();// ???????????????????????????????????????????
s.fc();
return 0;
}
Answer the question
In order to leave comments, you need to log in
Why is it possible to call a non-const method through a const reference?
S s; const S& rc = s; s.f();// ???????????????????????????????????????????
rc.f();
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question