@protocol ADelegate<NSObject>
- (void) methods;
@end
@interface ClassA:NSObject
- (void) Amethods
@property(assign, non atomic) id <ADelegate>delegate;
@end
@implementation ClassA
- (void) Amethods
{
[delegate methods];
ClassB *classB = (ClassB *)delegate;
[classB Bmethods];
}
@end
@interface ClassB<ADelegate>
- (void) Bmethods;
@end
@implementation ClassB
-(id)init
{
ClassA *A = [[ClassA alloc] init];
A.delegate = self;
}
- (void) Bmethods
{
//do something
}
- (void) methods
{
//do something
}
@end