Any difference between the two dealloc methods?

So, I redefine the dealloc method because the object is a composite object consisting of one other object.

I originally had this dealloc method:

-(id) dealloc; // Override to release the Rectangle object’s memory 
{
    [rect release];
    [super dealloc];
    return self;
}

After looking in the book, I saw another answer:

{
   [rect release];
   return [super dealloc];
}

just wondering if both will work the same.

Thanks,

Nick

+3
source share
2 answers

They are both wrong. deallocreturns void, not id:

- (void) dealloc {
  [rect release];
  [super dealloc];
}
+10
source

NSObject: dealloc . , ​​. , dealloc .

NSObject...

0

Source: https://habr.com/ru/post/1727647/


All Articles