例如下面的代码:
int funx()
{
return 99;
}
int testfunc(int x, int y = funx())
{
return x + y;
}
int main() {
int u = testfunc(1);
cout << "u = " << u << endl;
int x = 0;
cin >> x;
return 0;
}
很明显, testfunc 的第二个参数, 是一个函数的返回值, 也就是说, 在进行 testfunc 这个函数运算之前, 还需要先计算 funx
也算挺有意思的写法吧.