Re: private methods and variables
Re: private methods and variables
- Subject: Re: private methods and variables
- From: "Robert Lang" <email@hidden>
- Date: Tue, 29 Jul 2008 22:24:48 +0100
I think that's because when you compile the code, if one of your methods
forward references a private method and you haven't declared it in the
interface, you will get a warning.
Also, when you declare privateVariable in the implementation block you are
not declaring it as an instance variable of MyClass but instead as a normal
C variable in global scope.
Best,
Robert
On Tue, Jul 29, 2008 at 10:02 PM, Torsten Curdt <email@hidden> wrote:
> 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