////ProtectedDelegate.h//oc10_ Proxy Reverse pass -through value////Created by zhangxueming on 15/6/24.//Copyright (c) 2015 zhangxueming. All rights reserved.//#import<Foundation/Foundation.h>@protocolProtecteddelegate <nsobject>-(void) bark;@end////Dog.h//oc10_ Proxy Reverse pass -through value////Created by zhangxueming on 15/6/24.//Copyright (c) 2015 zhangxueming. All rights reserved.//#import<Foundation/Foundation.h>#import "ProtectedDelegate.h"#import "Person.h"@interfaceDog:nsobject <ProtectedDelegate>@property (nonatomic) person*Master;@end////DOG.M//oc10_ Proxy Reverse pass -through value////Created by zhangxueming on 15/6/24.//Copyright (c) 2015 zhangxueming. All rights reserved.//#import "Dog.h"@implementationDog- (void) bark{NSLog (@" Wang Wang Wang ..."); [Self.master report:arc4random ()% -+1];}@end////Person.h//oc10_ Proxy Reverse pass -through value////Created by zhangxueming on 15/6/24.//Copyright (c) 2015 zhangxueming. All rights reserved.//#import<Foundation/Foundation.h>#import "ProtectedDelegate.h"@interfacePerson:nsobject@property (Assign, nonatomic)ID<ProtectedDelegate>Delegate;- (void) go;- (void) Report: (Nsinteger) count;@end////person.m//oc10_ Proxy Reverse pass -through value////Created by zhangxueming on 15/6/24.//Copyright (c) 2015 zhangxueming. All rights reserved.//#import "Person.h"@implementation Person- (void) go{[self.Delegatebark];}- (void) Report: (Nsinteger) count{NSLog (@"killed%li people", count);}@end
////main.m//oc10_ Proxy Reverse pass -through value////Created by zhangxueming on 15/6/24.//Copyright (c) 2015 zhangxueming. All rights reserved.//#import<Foundation/Foundation.h>#import "Person.h"#import "Dog.h"intMainintargcConst Char*argv[]) {@autoreleasepool { person*xiaoxin =[[Person alloc] init]; Dog*dog =[[Dog alloc] init]; Xiaoxin.Delegate=Dog; Dog.master=xiaoxin; [Xiaoxin go]; } return 0;}
oc10_ Proxy Reverse pass-through value