I am reading a book on iOS programming (specifically, iOS Programming: The Big Ranch Guide, 2nd edition, page 69 if you have it).
The author shows an example where we override the dealloc function so that we can release the instance variables. After releasing the instance variables, there is a final line that reads:
[super dealloc];
Why does it deallocate super? Why would it not deallocate self?
I thought self referred to the instance and super referred to its superclass. If you add a subclass to NSObject called Thingamabob, and you declared a method for Thingamabob which read
[self dealloc]
what's the difference? What would that deallocate?
The author shows an example where we override the dealloc function so that we can release the instance variables. After releasing the instance variables, there is a final line that reads:
[super dealloc];
Why does it deallocate super? Why would it not deallocate self?
I thought self referred to the instance and super referred to its superclass. If you add a subclass to NSObject called Thingamabob, and you declared a method for Thingamabob which read
[self dealloc]
what's the difference? What would that deallocate?