Returning results from a helper method [closed]
Say I have the following helper method
public int doTheSum(int num1, int num2)
{
return num1 + num2;
}
And this method
public int doSum(int num1, int num2)
{
开发者_JS百科 return the answer from the helper method
}
So how do i get the method to return the result from the helper method
it's as easy as that:
public int doSum(int num1, int num2)
{
return doTheSum(num1,num2);
}
public int doSum(int num1, int num2)
{
return doTheSum(num1, num2);
}
public int doSum(int num1, int num2)
{
return this.doTheSum(num1, num2)
}
That would just be a method call to the doTheSum
method:
public int doSum(int num1, int num2)
{
return doTheSum(num1, num2);
}
精彩评论