What is the main difference in object creation between Java and C++?

后端 未结 7 666
感动是毒
感动是毒 2021-01-31 19:12

I\'m preparing for an exam in Java and one of the questions which was on a previous exam was:\"What is the main difference in object creation between Java and C++?\"

I t

7条回答
  •  感动是毒
    2021-01-31 20:07

    I would answer: C++ allows creating an object everywhere: on the heap, stack, member. Java forces you allocate objects on the heap, always.

提交回复
热议问题