/* I understand that the number is being multiplied by
GetPower but I just don't understand what the GetPower function exactly does if you multiply number times power -1 or what, because I really don't understand where the definition for this one is at. Please help */
functions are resolved by the type of argument that is passed, not the value of the argument. The same function gets called for getPower(2 , 3) as for getPower(2 ,5 ) as for getPower(4, 5).
Running though a call of getPower(2,3).
Code:
getPower(2,3)
returning 2 * getPower(2,2)
getPower(2,2)
returning 2 * getPower(2,1)
getPower(2,1)
returning 2
Back in getPower(2,2), knows getPower(2,1) is 2
returning 2 * getPower(2,1), or 4
Back in getPower(2,3), knows getPower(2,2) is 4
returning 2 * getPower(2,2), or 8
See the stack effect? The indent gets bigger and bigger until it reaches the base case (pow = 1), at which case it starts shrinking until the function is resolved.