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

后端 未结 22 1660
予麋鹿
予麋鹿 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-22 00:15

    Another good reason to use pointers would be for forward declarations. In a large enough project they can really speed up compile time.

提交回复
热议问题