samedi 1 août 2015

Overriding property setter from parent class

I don't seem to find the answer to this one.

In a base class I define this

@property (nonatomic, assign) NSInteger foo;

And have a custom setter

- (void)setFoo:(NSInteger)foo {
    _foo = foo;
}

So far so good!. Now I have a derived class, and try to override the property setter

- (void)setFoo:(NSInteger)foo {
    _foo = foo + 1;
}

the compiler says Use of undeclared identifier _foo on the derived class' implementation. What is the proper way to do this?

Aucun commentaire:

Enregistrer un commentaire