So where is this calling super?

Posted by dontWatchMyProfile on Stack Overflow See other posts from Stack Overflow or by dontWatchMyProfile
Published on 2010-06-11T12:48:36Z Indexed on 2010/06/11 12:52 UTC
Read the original article Hit count: 178

Filed under:
|

From the Core Data docs:

Inheritance If you have two subclasses of NSManagedObject where the parent class implements a dynamic property and its subclass (the grandchild of NSManagedObject) overrides the methods for the property, those overrides cannot call super.

@interface Parent : NSManagedObject
@property(nonatomic, retain) NSString* parentString;
@end

@implementation Parent
@dynamic parentString;
@end

@interface Child : Parent
@end

@implementation Child
- (NSString *)parentString
{
    // this throws a "selector not found" exception
    return parentString.foo;
}
@end

very, very funny, because: I see nobody calling super. Or are they? Wait... parentString.foo results in ... a crash ??? it's a string. How can that thing have a .foo suffixed to it? Just another documentation bug?

© Stack Overflow or respective owner

Related posts about iphone

Related posts about core-data