Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

can we override alloc and dealloc in objective C?

I know that this is rarely required to override the alloc or dealloc methods,but if required is it possible in iPhone programming?

like image 815
User97693321 Avatar asked Sep 29 '11 11:09

User97693321


1 Answers

You can and indeed, you should (if using manual memory management) override dealloc to release any resources you hold (not forgetting to call [super dealloc] when finished). Overriding alloc is possible but, as you say, rarely needed.

like image 57
Adam Wright Avatar answered Sep 27 '22 22:09

Adam Wright