c++: when to use pointers?

后端 未结 14 1700
无人共我
无人共我 2020-12-12 22:48

After reading some tutorials I came to the conclusion that one should always use pointers for objects. But I have also seen a few exceptions while reading some QT tutorials

14条回答
  •  伪装坚强ぢ
    2020-12-12 23:50

    Use pointers when you don't want your object to be destroyed when the stack frame is emptied.

    Use references for passing parameters where possible.

提交回复
热议问题