Class method comes first?


#1

Just wondering… in the section of this chapter on Class methods, there’s written: “Notice the order of the declarations for the methods. Class methods come first, followed by …”. A little while later, in the section on Exceptions and Unrecognized Selectors, you’re asked to declare a new method - (void)doSomethingWeird; This (instance) method is declared above the class method + (id)randomItem; Why?!


#2

The order does not matter, but it is considered good style not to mix them. Declare/define all class methods first, then the instance methods.


#3

ok, so probably it would’ve been a little cleaner if they’d let you add the instance method below the class method that’s already there, although it doesn’t have any real consequences :wink:
thx for answering!