title: Questions about Class Extensions and inheritance in objective-c
body: <p>I do not have anything in particular to achieve, but rather I am trying to learn more about class extension.</p>
  
  <p>This is the explanation of class extension directly from <a href="http://developer.apple.com/library/ios/#documentation/cocoa/conceptual/objectivec/chapters/occategories.html" rel="nofollow">apple Categories and extensions</a>:</p>
  
  <pre><code>@interface MyClass : NSObject
  @property (retain, readonly) float value;
  @end
  
  // Private extension, typically hidden in the main implementation file.
  @interface MyClass ()
  @property (retain, readwrite) float value;
  @end
  </code></pre>
  
  <p>it does make perfect sense to me, however, supposing I have a MyClass2 extending MyClass:</p>
  
  <pre><code>@interface MyClass2 : MyClass
  @property (retain, readwrite) float value;
  @end
  </code></pre>
  
  <p>so I have few questions, which I could easily answer if class extensions weren't involved:</p>
  
  <ul>
  <li>at runtime, when in <strong>MyClass</strong> I am doing an assignment <strong>self.value=2</strong> or just calling <strong>float x=self.value</strong> , which setter and getter @property are called ? MyClass or MyClass2 ?</li>
  <li>shouldn't the compiler at least issue a warning about a readonly property being redefined ?</li>
  <li>I know @property are backed by an ivar, so how many ivar are there in the end ? Related to this, calling the same self.value from <strong>MyClass2</strong> point of view which ivar would set ?</li>
  </ul>