d*********1 发帖数: 25 | 1 In the 4th version of C++ primer, regarding smart pointer, it invokes the
HasPtr as const reference, how could it changes the value of rhs?
++rhs.ptr->use
and --ptr->use | d*********1 发帖数: 25 | 2 I have done a test that
rhs.ptr can't be changed , eg rhs.ptr=NULL //illegal
so, in this case, the pointers in the class of HasPtr are defined as:
datatype * const pointer;
so the value of pointer can be changed.
it is a bit of tricky. |
|