Why should I use a pointer rather than the object itself?

后端 未结 22 2148
予麋鹿
予麋鹿 2020-11-21 23:26

I\'m coming from a Java background and have started working with objects in C++. But one thing that occurred to me is that people often use pointers to objects rather than t

22条回答
  •  南旧
    南旧 (楼主)
    2020-11-21 23:59

    With pointers ,

    • can directly talk to the memory.

    • can prevent lot of memory leaks of a program by manipulating pointers.

提交回复
热议问题