Consider the following text in http://developer.apple.com/library/ios/#documentation/general/conceptual/CocoaEncyclopedia/Initialization/Initialization.html.
Inherited initializers are a concern when you create a subclass. Sometimes a superclass init… method sufficiently initializes instances of your class. But because it is more likely it won’t, you should override the superclass’s initializer. If you don’t, the superclass’s implementation is invoked, and because the superclass knows nothing about your class, your instances may not be correctly initialized.
On the same page I find this text:
Every object that declares instance variables should implement an initializing method—unless the default set-everything-to-zero initialization is sufficient.
My question is:
If I skip the init method in class B, where class B inherits from A, can I trust that B’s non-inherited member variables are set to zero?
Objective-C will set all ivars of any new object to zero:
So it’s okay to skip implementing an initialization method for your class if you don’t have any ivars/properties that need to be initialized. You must, of course, still initialize new objects by calling
-initor some other initialization method so that the superclass has an opportunity to initialize itself.