Why are we declaring a method like
- (void) createBudget: (double) aBudget withExchangeRate: (float) anExchangeRate;
Why not like:
-(void) createBudget: (double) aBudget; -(void) withExchangeRate: (float) anExchangeRate;"
in Objective-C
What is the use of declaring a method in first way..?
Okay you are misunderstanding the method and its parameters.
declares the
createBudgetmethod with two parameters (messages it can receive)aBudgetandanExchangeRate. Use would be:the second way is declaring two methods and while it may work it is a bit odd to have two methods when the idea is to create a budget with a declared exchange rate.