C++ is very particular about type
checking, and this extends to
pointer assignments. You can
assign the address of a non-const object to a const pointer
because you’re simply promising not to change something that is OK to
change. However, you can’t assign the address of a const object to
a non-const pointer because then you’re saying you might change the
object via the pointer. Of course, you can always use a
cast to force such an assignment, but this is bad
programming practice because you are then breaking the constness of the
object, along with any safety promised by the const. For
example: