#include<iostream>
class _ctor
{
public:
_ctor() { std::cout<<"\nCtor";}
~_ctor(){ std::cout<<"\nDtor";}
};
_ctor A(); // --> Is the Constructor Really called? I do not see the Output printed
//_ctor A;
int main(){
return 0;
}
上面代碼的輸出在此Link 給出我沒有看到構造函數獲取調用,可能是什麼問題?如果它不應該被稱爲那麼這是什麼意思_ctor A();
?構造函數在這裏被調用嗎?
FYI名字'_ctor'被保留,這使得你的程序形成不良的(這無關與已經回答了這個問題)。在[這個問題]中的更多細節(http://stackoverflow.com/questions/228783/what-are-the-rules-about-using-an-underscore-in-ac-identifier) – Motti 2011-03-21 19:18:03