title: Incompatible pointer types returning **'from a function with result type '*'
body: <p>Basically, I have a base class called BaseObject.  2nd type of classes called RedObject, BlueObject. that are subclasses of BaseObject class.  </p>
  
  <p>So, in the RedObject.h, it has:</p>
  
  <pre><code>#import "BaseObject.h"
  
  @interface RedObject : BaseObject
  </code></pre>
  
  <p>And in the BlueObject.h, it has:</p>
  
  <pre><code>#import "BaseObject.h"
  
  @interface BlueObject : BaseObject
  </code></pre>
  
  <p>I also have a third type of class called MyObject.  In the MyObject.h file, it has:</p>
  
  <pre><code>#import "RedObject.h"
  #import "BlueObject.h"
  
  @interface MyObject : NSObject
  
  -(id)init:(char)objectType;
  </code></pre>
  
  <p>In the MyObject.m file, it has:</p>
  
  <pre><code>-(id)init:(char)objectType
  {
      self = [super init];
      switch (objectType) 
      {
          case 'R':
          {
              return [[RedObject alloc]init];  // this is where the yellow warning message 1
          }
          case 'B':
          {
              BlueObject *blueObject = [[BlueObject alloc]init];
              return blueObject;          // this is where the yellow warning message 2
          }
          default:
              break;
      }
      return self;
  }
  </code></pre>
  
  <p>Waring message 1: Incompatible pointer types returning <em>RedObject</em>'from a function with result type 'MyObject*'</p>
  
  <p>Waring message 2: Incompatible pointer types returning <em>BlueObject</em>_strong'from a function with result type 'MyObject*'</p>
  
  <p>When I tried to instantiate an instance of MyObject from a caller class, it works fine.  I can verify that I have accessed to all properties of the RedObject/BlueObject and the BaseObject.  But not sure how to remedy the yellow warning.  Or if I missed something?</p>
  
  <pre><code>MyObject *myObject = [[MyObject alloc]init:'R'];  // or 'B'
  </code></pre>