• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Private Method?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Private Method?


  • Subject: Re: Private Method?
  • From: Graham Cox <email@hidden>
  • Date: Mon, 07 Nov 2011 18:39:36 +1100

On 07/11/2011, at 9:10 AM, 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?

Could it be an override of a method inherited from a superclass?

> If the former, how does this technique compare with the trick of putting an…
>
> @interface someClass ()
> - (type) somePrivateMethod;
> @end
>
> …in the implementation?


I could be wrong, but I'm not sure that syntax is legal. The round brackets should include something in between to define a Category. For private methods, 'Private' is typical.

You can get away with not prototyping a method but only if code that refers to it comes after it in the implementation. But that is sloppy coding, so all methods should be prototyped, either publicly in the header, or privately as a category in the implementation.

--Graham


_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Private Method?
      • From: Joar Wingfors <email@hidden>
References: 
 >Private Method? (From: Bryan Harrison <email@hidden>)

  • Prev by Date: Private Method?
  • Next by Date: Re: Private Method?
  • Previous by thread: Private Method?
  • Next by thread: Re: Private Method?
  • Index(es):
    • Date
    • Thread