标签: c++ constructor default
可以说我有以下课程:
class Foo { public: Foo() = { std::cout << "Hello world!" << std::endl; } }
在主函数中,我调用以下内容:
int main() { Foo bar1(); // This doesn't echo "Hello World!" Foo bar2 = Foo(); // This does echo "Hello World!" }
我不明白为什么会这样?