I have written a program, which takes an input vector
of integers and prints all possible permutations of these integers.
In order to do that my program has two methods:
void Permutate(//input)
and void DoPermute(//necessary arguments)
Only the method Permutate
should be called by the user/client. DoPermutate
is a recursive method which is firstly called by Permutate
and provides the logic for the algorithm.
The question now: would you put Permutate
and DoPermutate
in a class
and make DoPermutate
private
, or would you put both methods in the global scope and not use classes
at all and thus expose DoPermutate
to the user/client? I am asking this because cmath
also has the utility methods in a global scope.
What would be a more elegant approach?