While reading the book by Mr. Kochan (1st ed): "Programming in Objective C" , I noticed that he uses the following code (you can see it at pages 342-344) to explain that the initWithString is preferable to stringWithString because the AddressCard class would own the name variable contents. Also, I don’t get any errors making repeated calls to the setName version with the stringWithString method. //I didn't added here the header file which has the needed declarations #import "AddressCard.h" @implementation AddressCard; -(NSString *) name{ return name; } //Recommended code: -(void) setName: (NSString *) theName{ [name release] name = [[NSString […]
Daily Archives: July 1, 2009
1 post