objective-c access level?
Does objective-c has the same access level as Java? For example, private, public,default and protected?
Does objective-c has the same access level as Java? For example, private, public,default and protected?
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.
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.
Thanks to give me more detail. That is really helpful to clear my confusions
objective-c access level?