Synthesized property of a protocol not seeing superclass' ivar

Posted by hyn on Stack Overflow See other posts from Stack Overflow or by hyn
Published on 2010-06-03T05:01:51Z Indexed on 2010/06/03 5:44 UTC
Read the original article Hit count: 287

Filed under:

I have a situation where my subclass is not seeing the superclass' instance variable x. The ivar is obviously @protected by default, so why do I get a compiler error "x undeclared"?

- (CGSize)hitSize
{
    // Compiler error
    return size;
}

EDIT: hitSize is a property of a protocol my subclass is conforming to. The problem was that I had hitSize @synthesized, which was the culprit. The question then is why can't the synthesized getter see the ivar?

© Stack Overflow or respective owner

Related posts about objective-c