objective-c access level?

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

Posted on Feb 5, 2013 8:10 AM

Reply
3 replies

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.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

objective-c access level?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.