Dot Syntax Question/Problem


#1

I’ve run across an error that I can’t seem to find the solution. When I’m turning the “Set Value In Dollars” on page 47 I get an error but I can’t figure out why. The error is that there is no Setter method but it works in accessor messages and only affects “Set Value in Dollars”. Can anybody shed some light on what I’m doing wrong, please?

Problems when using dot notation:

No problems when using accessor messages:

.h file:

.m file:

What am I doing wrong here?


#2

Simple typo - your setter should be setValueInDollars, not setvalueInDollars (lowercase v).

http://myfirstiphoneapp.co.uk


#3

Thanks for your reply. I still don’t understand because I have a lower case v in both my header as well as my implementation so shouldn’t it work in Main since both have the same case? Plus my assessor call has no problem with it. Is it a rule, that I didn’t grasp, that states that the first letter after the word SET must be capitalized and it applies only to the dot notation calls?


#4

Looking at setvalueInDollars and setValueInDollars, the compiler will read the latter as a setter, as it is reading it as “set Value” due to the fact that the next word begins with a capital; whereas it reads the former as “setvalue” (one word). It is not that clever :wink:


#5

Oh, i see now. Thanks for the clarification!