What's a naked pointer?

前端 未结 4 1633
被撕碎了的回忆
被撕碎了的回忆 2021-01-07 23:05

Observing Naked Pointers (see the first reply), the questions is pretty simple:

what is a Naked Pointer?

4条回答
  •  -上瘾入骨i
    2021-01-08 00:01

    Smart pointer are preferred way in C++ because they offer better better memory management . Smart pointers have extra information (counting the number of references, current ownership etc etc) along with the address of the object to which they point and therefore the name Smart pointer and Naked pointer don't hold such extra information and thus the name Naked pointer and therefore they don't delete the object after its no longer used because they don't have the information to do it . Hope it helps to retaining in our mind .

提交回复
热议问题