简体   繁体   English

在 C++ 中传递可选参数

[英]Optional argument passing in c++

需要格式化,编辑需要一些时间。

I cannot tell what you're asking but I'm going to attempt to interpret it as what I read..我不知道你在问什么,但我会尝试把它解释为我读到的。

void function_one(int a, int b = 3);
void function_two(int a);

void function_one(int a, int b)
{
    function_two(b); //pass second argument to function two..
}

void function_two(int a)
{
    function_one(5);
}

Note that the above is infinite recursion due not having a base case condition.请注意,由于没有基本情况,以上是无限递归。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM