Implement the following methods: retain, release, autorelease.

Answer

-(id)retain

{

NSIncrementExtraRefCount(self);

return self;

}

-(void)release

{

if(NSDecrementExtraRefCountWasZero(self))

{NSDeallocateObject(self);

}

}

-(id)autorelease

{ // Add the object to the autorelease pool

[NSAutoreleasePool addObject:self];

return self;

}

All ios Questions

Ask your interview questions on ios

Write Your comment or Questions if you want the answers on ios from ios Experts
Name* :
Email Id* :
Mob no* :
Question
Or
Comment* :
 





Disclimer: PCDS.CO.IN not responsible for any content, information, data or any feature of website. If you are using this website then its your own responsibility to understand the content of the website

--------- Tutorials ---