Created
April 30, 2010 21:33
-
-
Save landonf/385784 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
#import <Foundation/Foundation.h> | |
/* | |
* File fails to compile with an warning in the ExtendedPropertyClass: | |
* test.m:46: warning: property ‘property’ requires method '-property' to be | |
* defined - use @synthesize, @dynamic or provide a method implementation | |
* | |
* If ExtendedPropertyClass inherits the -method implementation from | |
* PropertyClass, shouldn't it also inherit the -property implementation? | |
*/ | |
// Root protocol and class | |
@protocol PropertyProtocol | |
- (NSString *) method; | |
@property(readonly) NSString *property; | |
@end | |
@interface PropertyClass : NSObject <PropertyProtocol> { | |
NSString *property; | |
} | |
@end | |
@implementation PropertyClass | |
@synthesize property; | |
- (NSString *) method { return @"method"; }; | |
@end | |
// Subclass/subprotocol of the above | |
@protocol ExtendedPropertyProtocol <PropertyProtocol> | |
- (NSString *) extendedMethod; | |
@property(readonly) NSString *extendedProperty; | |
@end | |
@interface ExtendedPropertyClass : PropertyClass <ExtendedPropertyProtocol> { | |
NSString *extendedProperty; | |
} | |
@end | |
@implementation ExtendedPropertyClass | |
@synthesize extendedProperty; | |
- (NSString *) extendedMethod { return @"method"; }; | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment