2
可能重复:
Do the parentheses after the type name make a difference with new?这两个C++语句有什么区别?
在C++中,就是这两个语句之间的区别?
Class clg
{
public :
int x,y,z;
};
int main(void)
{
clg *ptrA = new clg; //
clg *ptrB = new clg(); // what is the importance of "()" ???
return 0;
}
重复的[类型名称后的圆括号与新的有所不同?](http://stackoverflow.com/questions/620137/do-the-parentheses-after-the-type-name-make-a -difference-with-new) – 2011-04-10 08:19:30
可能的重复项:[类型名称后面的圆括号是否与新的有所不同?](http://stackoverflow.com/questions/620137/do-the-parentheses-after-the-type名称使一个新的差异),[不使用括号在新的(c + +)构造函数调用](http://stackoverflow.com/questions/5211090/not-using-parentheses-in-constructor- call-with-new-c),[没有参数的语言标准的C++构造函数没有括号?](http://stackoverflow.com/questions/2318650/is-no-parentheses-on-ac-constructor-用-no-arguments-a-language-standard) – 2011-04-10 08:20:30
谢谢James和Cody。 – Uday 2011-04-10 08:26:05