I have two similar functions. Both functions contain a nested for -loop. How I can combine these two functions to decrease duplicated code.
The only difference between funcA and funcB is funcB calls func_2 in the loop.
The two functions like below.
void funcA()
{
for (int i = 0; i < size; i++)
{
for (int j = 0; j < size; j++)
{
func_1();
}
}
}
void funcB()
{
for (int i = 0; i < size; i++)
{
for (int j = 0; j < size; j++)
{
func_1();
func_2();
}
}
}