Skip navigation

objective-c access level?

380 Views 3 Replies Latest reply: Feb 5, 2013 10:02 AM by Febwind RSS
Febwind Calculating status...
Currently Being Moderated
Feb 5, 2013 8:10 AM

Does objective-c has the same access level as Java? For example, private, public,default and protected?

  • etresoft Level 7 Level 7 (23,880 points)
    Currently Being Moderated
    Feb 5, 2013 9:42 AM (in response to Febwind)

    Yes, but they are rarely used. You can specify @protected or @private if you want. That is an artifact of old-school object-oriented software which really isn't practical in the real world.

  • g_wolfman Level 4 Level 4 (1,110 points)
    Currently Being Moderated
    Feb 5, 2013 9:51 AM (in response to Febwind)

    You can indicate that attriburtes are public, protected or private, which will protect them from illegal access at compile-time.  Protected is the default in Objective-C.  However, becasue Objective-C is a dynamic language, you can't really control run-time access to the attributes the way you can in a static language.


    All methods are public, all the time, in Objective-C.  You can mark them as @interface and @implementation to indicate that they are (or aren't) supposed to part of the object's API.  Methods marked @implementation won't be exposed.  But that doesn't actually stop anyone from calling them if they know the methods exist.


More Like This

  • Retrieving data ...

Bookmarked By (0)


  • This solved my question - 10 points
  • This helped me - 5 points
This site contains user submitted content, comments and opinions and is for informational purposes only. Apple disclaims any and all liability for the acts, omissions and conduct of any third parties in connection with or related to your use of the site. All postings and use of the content on this site are subject to the Apple Support Communities Terms of Use.