0
有没有办法选择哪些函数参数在Python中重写像在Python中?C++“重载”第二个默认函数参数
示例代码:
#include <iostream>
using namespace std;
void test(int a=1, int b=1) {}
int main()
{
test(b=2);
cout << "kkk" << endl;
}
有没有办法选择哪些函数参数在Python中重写像在Python中?C++“重载”第二个默认函数参数
示例代码:
#include <iostream>
using namespace std;
void test(int a=1, int b=1) {}
int main()
{
test(b=2);
cout << "kkk" << endl;
}
没有出现不。在C++中,您总是需要按照它们在函数声明中出现的顺序来提供参数。
许多情况下存在的解决方法是为该函数提供重载。
啊当然,谢谢你,那会工作,非常感谢 – shishkebab