i'm sorry, i feel like if i do as you say, it's gonna create a endless loop as the child will have a member which is the parent which has a child which has a parent....and so on. Am i wrong?
Here's what i understand from your advice:
Code:
//class_A.h
//-----------
@interface class_A
{
@public
class_B my_class_B;
}
-(void)init;
@end
Code:
//class_A.m
//-----------
@implementation class_A
-(void) init
{
[my_class_B initWithParent:self]; //is this ok?
}
@end
Code:
//class_B.h
//------------
@interface class_B
{
@private
class_A my_parent; //This what i doubt is good...
}
-(void) initWithParent: (id) parent;
@end
Code:
//class_B.m
//------------
@implementation class_B
-(void) initWithParent: (id) parent
{
self=[super init];
if (self){
my_parent=parent;
}
return self;
}
@end