If I have this
Code:
const HermitCrab* t = &b;
b.GetShellSize();
how can I make sure it compiles. Also if I have this
Code:
HermitCrab a(1);
const HermitCrab b(3);
Will Compile Code…
(Yes/No)?
____________ 1 HermitCrab* const q = &a;
q->MoveIntoShell(8);
____________ 2 const HermitCrab* p = &a;
p->MoveIntoShell(8);
____________ 3 HermitCrab* const m = &b;
m->MoveIntoShell(2);
____________ 4 const HermitCrab* r = &b;
r->MoveIntoShell(8);
____________ 5 const HermitCrab* p = &b;
p = &a;
are these answers right
1) No because the pointer is read only
2) Yes
3) No because the object is constant therefore it most have a const object pointer
4) Yes
5) Yes