i am reading from a book on Objective-C by Stephen G. Kochan.
there is an address book program from the book that i am working on.
i got the one program to work which i called 15.9 (it displays a person's name and email address) the next program from the book adds methods to program 15.9.
one of the methods deals with overriding the dealloc method.
another method deals with releasing the memory from the old email and old name methods.
and finally a method to set the name and email fields with one call.
just wondering where i should put the new methods. like how do i know what file (implementation, interface, or both,) to put these knew methods into?
there is an address book program from the book that i am working on.
i got the one program to work which i called 15.9 (it displays a person's name and email address) the next program from the book adds methods to program 15.9.
one of the methods deals with overriding the dealloc method.
Code:
-(void) dealloc
{
[name release];
[email release];
[super dealloc];
}
another method deals with releasing the memory from the old email and old name methods.
Code:
-(void) setName: (NSString *) theName
{
[name release];
name = [[NSString alloc] initWithString: theName];
}
-(void) setEmail: (NSString *) theEmail
{
[email release];
email = [[NSString alloc] initWithString: theEmail];
}
and finally a method to set the name and email fields with one call.
Code:
-(void) setName: (NSString *) theName andEmail: (NSString *) theEmail
{
[self setName: theName];
[self setEmail: theEmail];
}
just wondering where i should put the new methods. like how do i know what file (implementation, interface, or both,) to put these knew methods into?