FROM : Todd Heberlein
DATE : Sun Apr 29 02:58:59 2007
My questions are: (1) When an NSArray object is sent a "retain"
message, is that message also sent to all the objects it contains?
(2) When a subclass of an NSObject receives a "retain" message, does
it forward the message to each instance variable in the object?
As example, suppose there is an EvilCorp, which has an array of
showrooms, each showroom has an array of cars, and each car has an
array of parts. When I send the "retain" message to the first array
of showrooms, will that "retain" message be propagated all the way
down to the car's parts objects? (pseudo code below is provided just
for illustration purposes).
Thanks,
Todd
@interface EvilCorp : NSObject
{
NSString * boss;
NSMutableArray * showrooms; // a list of showrooms
}
...
@ end
@interface Showroom : NSObject
{
NSString * name;
NSMutableArray * carList; // list of cars
}
...
@end
@interface Cars : NSObject
{
int id_number;
NSMutableArray * partsList; // list of parts
}
...
@end
DATE : Sun Apr 29 02:58:59 2007
My questions are: (1) When an NSArray object is sent a "retain"
message, is that message also sent to all the objects it contains?
(2) When a subclass of an NSObject receives a "retain" message, does
it forward the message to each instance variable in the object?
As example, suppose there is an EvilCorp, which has an array of
showrooms, each showroom has an array of cars, and each car has an
array of parts. When I send the "retain" message to the first array
of showrooms, will that "retain" message be propagated all the way
down to the car's parts objects? (pseudo code below is provided just
for illustration purposes).
Thanks,
Todd
@interface EvilCorp : NSObject
{
NSString * boss;
NSMutableArray * showrooms; // a list of showrooms
}
...
@ end
@interface Showroom : NSObject
{
NSString * name;
NSMutableArray * carList; // list of cars
}
...
@end
@interface Cars : NSObject
{
int id_number;
NSMutableArray * partsList; // list of parts
}
...
@end
| Related mails | Author | Date |
|---|---|---|
| Todd Heberlein | Apr 29, 02:58 | |
| Guy English | Apr 29, 03:04 |






Cocoa mail archive

