Difference between A* pA = new A; and A* pA = new A();

后端 未结 4 988
野趣味
野趣味 2020-12-02 17:43

in C++, what is the exact difference between both following dynamic object creations :

A* pA = new A;

A* pA = new A(); 

I did some tests,

4条回答
  •  眼角桃花
    2020-12-02 18:06

    The lexer will have to scan two characters less in the first version, so the compilation process is a little faster ;)

提交回复
热议问题