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

后端 未结 5 1355
说谎
说谎 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:36

    Yes, always a pointer. Even if you want to overload new, return type must be void*.
    And you are right about purpose

提交回复
热议问题