Possible Duplicate:
Why does the default parameterless constructor go away when you create one with parameters如果我们在C++中重载构造函数,那么默认的构造函数仍然存在?
我写了下面的程序
#include <iostream>
class A {
public:
A(int i) {std::cout<<"Overloaded constructor"<<std::endl;}
}
int main() {
A obj;
return 0;
}
当我编译我收到以下错误的程序:
没有匹配函数来调用A :: A() 的候选人是: A :: A(int) A :: A(const A &)
你回答了你自己的问题。这是一个[好问题](http://stackoverflow.com/questions/11792207/why-does-the-default-parameterless-constructor-go-away-when-you-create-one-with)为什么。 – chris