the “new” operator in c++, pointer question

后端 未结 5 1354
说谎
说谎 2021-02-19 17:53

Dumb question, but whenever you call new, do you always have a pointer?

SomeClass *person = new SomeClass();

And is that because you need a poi

5条回答
  •  后悔当初
    2021-02-19 18:26

    new creates an object on the heap and all it can return is its address - a pointer.

提交回复
热议问题