As already noted in the comments (see @bitmask's comment above), your Func
is not a good example for multiple recursion.
Since this is for learning purposes, I'd like to introduce a classic example for multiple recursion. It is the following implementation for fibonaci series (Fibonacci - Wikipedia). Each number in the series (except the initial 2) is the sum of it's 2 predecessors.
The code below prints the 10 first elements in the series using multiple recursion:
#include <iostream>
int fib(int n)
{
if (n <2) {
return n;
}
return fib(n - 1) + fib(n - 2);
}
void main()
{
for (int i = 0; i < 10; ++i)
{
std::cout << fib(i) << ",";
}
}
As explained in the comments, multiple recursion works very similar to single recursion. The calls will be done in an order similar to the way DFS (Depth-first search - Wikipedia) is working. I.e. the first recuresive call will complete (including all the recursive calls made by it), then the second will be executed.
Note: my answer is based on the understanding that the question is in the context of studying the subject. However - using recursion causes some performance penalties (the cost of a function calls, and using the stack for it). There are usually more efficient ways to implement solution to problems like that. In the case of fibonaci if you need to generate multiple elements in the series, it's more efficient to do it iteratively. You need only to keep track of previous element and the one before it.
You can see here more about the subject in general: recursion versus iteration.