Question about designing your own methods


#1

In the challenge, I encountered another problem, re: designing the methods for calculating the values.

In the solutions here, there are two kinds of method declaring: one with arguments, one without.
In the end, I chose

-(float) valueInDollars {
    return currentSharePrice * numberOfShares;

but I saw other solutions here, with an argument thingy after the method, something like:

-(float) valueInDollars:(float)v {
//etc
}

Is one way better than the other?


#2

This is a getter method:

-(float)valueInDollars
{
      return currentSharePrice * numberOfShares;
}

computing and returning the value of the shares.

This one on the other hand:

-(float)valueInDollars:(float)v
{
   ...
}

sounds like a getter method but takes an argument, which is not the standard way of declaring a getter, and what it does is not clear.


#3

Thanks!