Created
May 23, 2012 16:56
-
-
Save jdelStrother/2776354 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @protocol NamedObject <NSObject> | |
| -(NSString*)name; | |
| @end | |
| ///////////////// | |
| @interface User : NSObject | |
| -(NSString*)name; | |
| @end | |
| ///////////////// | |
| @interface Greeter : NSObject | |
| @end | |
| @implementation Greeter | |
| -(id)init { | |
| if (self=[super init]) { | |
| User* user=[[User alloc] init]; | |
| [self sayHi:user]; // Sending 'User *__strong' to parameter of incompatible type 'id<NamedObject>' | |
| } | |
| return self; | |
| } | |
| -(void)sayHi:(id<NamedObject>)object { | |
| NSLog(@"Hi %@", object.name); | |
| } | |
| @end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment