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

Re: private methods and variables


  • Subject: Re: private methods and variables
  • From: Ken Thomases <email@hidden>
  • Date: Tue, 29 Jul 2008 18:53:45 -0500

On Jul 29, 2008, at 6:30 PM, Torsten Curdt wrote:

Thanks guys. I basically though that there was a difference between:

@implementation MyClass
int privateVariable;
@end

and

int privateVariable;
@implementation MyClass
@end

the first being being an ivar. The second just being a global.
But IIUC now - there really is no difference. That correct?

Correct.

On a somewhat-related subject, there _is_ a difference between:

@implementation MyClass
void someFunction(/* ... */)
{
	/* ... */
}
@end

and:

void someFunction(/* ... */)
{
	/* ... */
}

@implementation MyClass
@end


In the former, someFunction is considered to be a part of the implementation of the class and is permitted to access private and protected ivars of any MyClass instance it may get its hands on. In the latter, someFunction has no particular special relationship to MyClass.


Cheers,
Ken
_______________________________________________

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


References: 
 >private methods and variables (From: Torsten Curdt <email@hidden>)
 >Re: private methods and variables (From: Ken Thomases <email@hidden>)
 >Re: private methods and variables (From: Torsten Curdt <email@hidden>)

  • Prev by Date: Re: private methods and variables
  • Next by Date: Re: private methods and variables
  • Previous by thread: Re: private methods and variables
  • Next by thread: Re: private methods and variables
  • Index(es):
    • Date
    • Thread