ex:
id c = [Circle new];
when creating object with new, two steps are performed :
(1) allocate memory for object
(2) object's init method is called
ex:
- (id) init
{
self = [super init];
return self;
}
alloc:
initialize all memory to 0
Hence, all instance variable have zero value
pointer to objects are nil
integer variable is 0
dealloc:
- (void) dealloc
沒有留言:
張貼留言