开发者

Returning results from a helper method [closed]

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center. Closed 11 years ago.

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);
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜