【发布时间】:2016-11-14 13:26:40
【问题描述】:
下面的类的声明有什么区别?
class A
{
public:
A()
{
std::cout << "A()\n";
}
~A()
{
std::cout << "~A()\n";
}
};
int main(int argc, char *argv[])
{
A a; // <-- this call the constructor and destructor
A b(); // <-- this is not!! what is a b()?
return 0;
}
什么是b()?
【问题讨论】:
标签: c++ constructor initialization most-vexing-parse