【发布时间】:2011-03-21 18:27:06
【问题描述】:
#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(); 是什么意思?
【问题讨论】:
-
仅供参考,名称
_ctor是保留的,这会使您的程序格式错误(这与已经回答的问题无关)。更多详情this question
标签: c++ visual-c++ c++11