class Complex
{
private:
float rp, ip;
//const int a=10;
//static int b;
//static const int c = 50;
public:
Complex();
//Complex(float );
/*Complex(float,float);*/
Complex(float , float = 20, float = 30);
}
上面的代码工作正常,但是当我尝试使用 3 个默认参数时
class Complex
{
private:
float rp, ip;
//const int a=10;//static int b;//static const int c = 50;
public:
Complex();
//Complex(float );
/*Complex(float,float);*/
Complex(float =10 , float = 20, float = 30);
}
我收到以下错误 -
main.cpp(12):错误 C2668:“Complex::Complex”:对
重载函数 complex.h(15) 的模糊调用:可能是“Complex::Complex(float,float,float)”complex.h(12) : 或“复杂::复杂(无效)”