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