title: Overriding @property declarations in Objective-C
body: <p>I often find that I know that a certain property of a base class will always be a certain type in a subclass.  For instance, in the example below, property <code>obj</code> will always be an NSString object in Derived.  However, I need this property to be the more generic id type in class Base.</p>
  
  <pre><code>@interface Base
  @property (strong, nonatomic) id obj;
  @end
  
  @implementation Base
  //@synthesize obj = obj_;
  @dynamic obj;
  @end
  
  
  @interface Derived : Base
  @property (strong, nonatomic) NSString *obj;
  @end
  
  @implementation Derived
  @synthesize obj = obj_;
  @end</code></pre>
  
  <p>Is this code correct?  I am concerned that @synthesize appears twice.  Is this creating two properties, or does the @synthesize declaration in Derived override the one in Base?</p>
  
  <p><strong>Edit:</strong> Changing @synthesize to @dynamic in Base makes more sense.</p>
  
  <p><strong>Edit:</strong> This requires iOS SDK 5.</p>