原因:定义函数的时候参数部分有默认值,如下: int classA::print(int a = 0) { std::cout << a << std::endl; } 分析:声明函数时参数可以有默认值,定义时不能。