If I apply a class that has no sensible default value, then what should I do with the init method Who does not take any argument? If there is no valid default, then the init method has no advantage.
My stomach says that it should release the object and return it to zero:
- (id) init {[self release]; Return zero; }
... but when to read NSObject:
Every class should guarantee that the init method gives either a full functional example of the class Or raises an exception.
This confuses me: (
An exception . :) Something like this:
- (id) init {[self release]; // self = zero; There is no need to throw an exception @ throw [NSE Expression exception: with: cause of NSGeneric Expression: @ "- Init is not supported" userInfo: zero]; }
Comments
Post a Comment