What happens when you call -init multiple times on one object, are there some hidden side effects?
Can you assume that no additional memory is allocated?
Would anything go against such an idea?
What happens when you call -init multiple times on one object, are there some
Share
Calling
-initmultiple times is undefined, unsupported, and will lead to bugs, crashes, and other unexpected behavior.Many classes —
NSString,NSArray, andNSDictionary, for example — don’t actually allocate anything when the+allocmethod is called. It isn’t until one of the various-init*methods are called that the object has enough context to figure out the most efficient means of doing whatever you ask.