On Nov 6, 2011, at 2:10 PM, Bryan Harrison wrote: > I'm reviewing some sample code and am looking at a class with a method > declared in @implementation which isn't mentioned in any @interface. > > Is this a private method, something else entirely, or merely sloppy coding?
That’s considered a private method. (Unlike in C++ there’s no way to absolutely prevent external code from calling it, but the compiler will give you warnings if you try to do it directly.) In Objective-C it’s considered good style to have the @interface section show *only* the public API of the class. Internal methods should go only in the @implementation. (If you need a forward declaration you can do that with a class continuation in the .m file.) This keeps the header more readable and hides the implementation details of the class from view. It also speeds up compilation a bit, and can avoid the need to #import more headers from your .h file. —Jens
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com