#include <iostream>
class A
{
public:
A(int n)
{
std::cout << "AAAAAAAAA" << std::endl;
}
A(const char * ch)
{
std::cout << ch << std::endl;
}
};
int main()
{
A a[3];
return 0;
}
g++ -Wall -c "testcpp.cpp" (在目录 E:\1_MYPROJECT\C++_Test 中)
testcpp.cpp: In function 'int main()':
testcpp.cpp:17:10: error: no matching function for call to 'A::A()'
testcpp.cpp:17:10: note: candidates are:
testcpp.cpp:9:9: note: A::A(const char*)
testcpp.cpp:9:9: note: candidate expects 1 argument, 0 provided
testcpp.cpp:5:9: note: A::A(int)
testcpp.cpp:5:9: note: candidate expects 1 argument, 0 provided
testcpp.cpp:2:7: note: A::A(const A&)
testcpp.cpp:2:7: note: candidate expects 1 argument, 0 provided
testcpp.cpp:17:7: warning: unused variable 'a' [-Wunused-variable]
编译失败。