When to use pointers and when not to?

后端 未结 5 1252
滥情空心
滥情空心 2020-12-02 08:21

I\'m used to doing Java programming, where you never really have to think about pointers when programming. However, at the moment I\'m writing a program in C++. When making

5条回答
  •  伪装坚强ぢ
    2020-12-02 08:36

    Both are OK under different conditions. For example, if you know how to construct b when an object of class Foo is constructed, the first is OK. But if you don't, the only choice is to use the second.

提交回复
热议问题