• 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
private methods and variables
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

private methods and variables


  • Subject: private methods and variables
  • From: Torsten Curdt <email@hidden>
  • Date: Tue, 29 Jul 2008 23:02:28 +0200

This question is NOT about private APIs from Apple but more about how to organize structure my own code.

Especially for a framework I don't want to expose implementation details to the interface.
So while I found the suggestion to use a special category like:


 @interface MyClass
 -(void) publicMethod;
 @end

 @interface MyClass (Private)
 {
 	int privateVariable;
 }
 -(void) privateMethod;
 @end

I am not sure why that would be better than to just do

 @interface MyClass
 -(void) publicMethod;
 @end

 @implementation MyClass

 int privateVariable;
 -(void) privateMethod {
 }

 -(void) publicMethod {
 }

 @end

Any wise words?

cheers
--
Torsten
_______________________________________________

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 methods and variables
      • From: Peter N Lewis <email@hidden>
    • Re: private methods and variables
      • From: "Robert Lang" <email@hidden>
    • Re: private methods and variables
      • From: Ken Thomases <email@hidden>
    • Re: private methods and variables
      • From: Bill Bumgarner <email@hidden>
  • Prev by Date: Re: getting the clicked-in view
  • Next by Date: Re: global NSMutableDictionary
  • Previous by thread: Re: getting the clicked-in view
  • Next by thread: Re: private methods and variables
  • Index(es):
    • Date
    • Thread