Reputation: 15778
First one:
- (void)dealloc {
[super dealloc];
[AboutButton release];
}
Second one:
- (void)dealloc {
[AboutButton release];
[super dealloc];
}
Both methods are delloc, first run the super first, the other run it later, which one is correct or there is no diff between two. thz.
Upvotes: 0
Views: 70
Reputation:
There is a difference, in that you are guaranteed the existence of ivars in the super class prior to the call to [super dealloc]
. After that call, the ivars will be gone.
I don't know if calling [super dealloc]
first will create a problem, but the Class Reference for NSObject
says you should free your memory first, and then call [super dealloc]
After performing the class-specific deallocation, the subclass method should incorporate superclass versions of dealloc through a message to super
Upvotes: 6