There are 3 modifiers: @private, @protected (by default) and @public. Being used to it in C ++ and other more reasonable languages, I always use @private for my fields. I hardly (if ever) see Apple’s SDK examples - they just rely on the standard version.
One fine day, I realized that Objective-C inheritance is a pretty fake feature: getting an interface from another doesn't mean that all private fields are now available for redefinition. The compiler still sees them and forbids defining a new private field with the same name, which goes orthogonally with the classical encapsulation paradigm in OOD.
So I'm a little upset. Perhaps I expect too much from the language because it is nothing more than a creation over the C standard.
So, are you using @private in your code? Why?
source
share