【发布时间】:2011-07-09 19:49:27
【问题描述】:
可能重复:
Do the parentheses after the type name make a difference with new?
所以我主要是:
Class* pC = new Class;
它的工作原理是
Class* pC = new Class();
我今天才意识到我省略了括号(所以我在某种程度上被最令人烦恼的解析的“相反”击中)。
我的问题:这两种形式是否等效?
【问题讨论】:
-
两个调用都调用默认构造函数。
标签: c++ parsing constructor new-operator