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