title: C# override function how to return null
body: <p>So I am trying to implement some inheritance and I am running into an issue. I am coming from java so I am basically trying to convert code. So for example in java you might have this.</p>
  
  <pre><code>public class galaxyFactory extends abstractFactory
  {
      @Override
      public galaxy setType()
      {   
          return new Spiral();
      }
  
      @Override
      SolarSystem setType() 
      {
          return null;
      }
  }
  </code></pre>
  
  <p>This will return a new Spiral object if your after a galaxy, and overrides the SolarSystem setType with a simple return null. However when trying to convert this into c# i come up with something like this. Which DOES NOT work, it errors out with "NullReferenceException was unhandled"</p>
  
  <pre><code>  class GalaxyFactory: AbstractFactory
    {
      public override Galaxy CreateProductA()
      {
          return new spiral();
      }
      public override SolarSystem CreateProductB()
      {
          return null;
      }
    }
  </code></pre>
  
  <p>What would I have to change my return null to get the same effect in c#? </p>