memory management objective c - returning objects from methods
Posted
by geeth
on Stack Overflow
See other posts from Stack Overflow
or by geeth
Published on 2010-04-30T05:09:14Z
Indexed on
2010/04/30
5:17 UTC
Read the original article
Hit count: 196
Hi, Please clarify, how to deal with returned objects from methods?
Below, I get employee details from GeEmployeetData function with autorelease, 1. Do I have to retain the returned object in Process method? 2. Can I release *emp in Process fucntion?
-(void) Process { Employee *emp = [self GeEmployeetData] }
+(Employee*) GeEmployeetData{
Employee *emp = [[Employee alloc]init]; //fill entity
return [emp autorelease];
}
© Stack Overflow or respective owner