开发者

Clarify xcode obj-c code

开发者 https://www.devze.com 2023-02-14 06:50 出处:网络
This is a simple one, it\'s just that I can\'t figure out what it means. Is it 4 different methods or one method with 4 parameters.

This is a simple one, it's just that I can't figure out what it means.

Is it 4 different methods or one method with 4 parameters.

+ (double)doCalc:(flo开发者_如何学Pythonat)interestRate
                    numOfCompounds:(int)interestFrequency
                    intialDeposited:(float)deposit
                    lengthOfTimeBanked:(int)period;

What confuses me is where it comes out with numOfCompounds:(int)interestFrequency.

Does it means it's a separate parameter?

Thanks in advance.


This is all one method. The method declaration doesn't end until the closing ;.


That is one method with four parameters. The whitespace and line breaks are there only for readability.

The four parameters are:

  1. interestRate, a float
  2. interestFrequency, an int
  3. deposit, a float
  4. period, an int

The name of the method, without the parameter signatures, is actually

doCalc:numOfCompounds:intialDeposited:lengthOfTimeBanked:

In one of the parts of the signature, for example numOfCompounds:(int)interestFrequency, numOfCompounds is the name of the parameter as seen by the calling code, while interestFrequency is the name of the parameter in the scope of the method.

0

精彩评论

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