Re: How to override properties

2015-10-02 Thread Graham Cox
> On 2 Oct 2015, at 3:47 pm, Gerriet M. Denkmann wrote: > > So I added @dynamic to the subclass, and all seems to be ok. Maybe. What happens if you pass a ‘someDataClass’ instance to -setStuff:, then return it as type subDataClass? It’s not a subDataClass, but your

Re: How to override properties

2015-10-01 Thread Charles Srstka
> On Oct 1, 2015, at 11:28 PM, Gerriet M. Denkmann wrote: > > I inherited some code with: > > @interface BaseThing : NSObject > > @property (nonatomic) SomeDataClass *stuff; > > @end > > > @interface SubThing : BaseThing > > @property (nonatomic) SubDataClass* stuff;

Re: How to override properties

2015-10-01 Thread Jens Alfke
> On Oct 1, 2015, at 9:28 PM, Gerriet M. Denkmann wrote: > > I don’t think that I want ’stuff’ to be implemented by its superclass. Rather > I want it to be overridden. So I am not sure, whether @dynamic is the right > thing to do. Implement -stuff and -setStuff: in the

Re: How to override properties

2015-10-01 Thread Gerriet M. Denkmann
> On 2 Oct 2015, at 12:40, Quincey Morris > wrote: > > On Oct 1, 2015, at 22:18 , Graham Cox wrote: >> >> It’s not really about making the compiler happy, it’s about making your code >> clear and bug-free. > >> The compiler is

How to override properties

2015-10-01 Thread Gerriet M. Denkmann
I inherited some code with: @interface BaseThing : NSObject @property (nonatomic) SomeDataClass *stuff; @end @interface SubThing : BaseThing @property (nonatomic) SubDataClass* stuff; // SubDataClass is a subclass of SomeDataClass @end @implementation SubThing // nothing

Re: How to override properties

2015-10-01 Thread Graham Cox
> On 2 Oct 2015, at 2:28 pm, Gerriet M. Denkmann wrote: > > don’t think that I want ’stuff’ to be implemented by its superclass. Are you sure? The only thing the subclass has changed about the property is its type, which is in itself a subclass of the original type, so

Re: How to override properties

2015-10-01 Thread Quincey Morris
On Oct 1, 2015, at 22:18 , Graham Cox wrote: > > It’s not really about making the compiler happy, it’s about making your code > clear and bug-free. > The compiler is telling you your design is probably faulty, but the correct > solution depends on your true intentions.