Skip to content

Instantly share code, notes, and snippets.

@landonf
Created April 30, 2010 21:33
Show Gist options
  • Save landonf/385784 to your computer and use it in GitHub Desktop.
Save landonf/385784 to your computer and use it in GitHub Desktop.
#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