If I have this class defined, how do I access the someObject
property in subclasses without compiler errors?
@interface MyBaseClass
// someObject property not declared here because I want it to be scoped
// protected. Only this class instance and subclass instances should be
// able to see the someObject property.
@end
// This is a private interface extension...properties declared here
// won't be visible to subclasses. However, I don't see any way to
// declare protected properties...
@interface MyBaseClass (private)
@property (nonatomic, readwrite, retain) NSObject *someObject;
@end
@interface MySubclass : MyBaseClass
@end
@implementation MySubclass
- (id) init {
// Try to do something with the super classes' someObject property.
// Always throws compile errors.
// Semantic Issue: Property 'someObject' not found
// object of type 'MySubclass *'
self.someObject = nil;
}
@end
I'm obviously not understanding how inheritance works in objective-c. Could someone enlighten me?