title: Is this a good example for representing the abstract factory pattern
body: <p>Want to check if this a good example for representing the abstract factory pattern.
  Here is the theme
  Dell (Factory) makes xps (Product)
  Dell (Factory) makes inspiron (Product)
  hp (Factory) makes envoy (Product)
  hp (Factory) makes presario (Product)</p>
  
  <p>BestBuy sells computers.</p>
  
  <pre><code>//Abstract factory
  abstract class ComputerFactory
  {
      public abstract Computer BuildComputer(Computer.ComputerType compType);
  }
  
  //Concrete factory
  class Dell : ComputerFactory
  {
      public override Computer BuildComputer(Computer.ComputerType compType)
      {
          if (compType == Computer.ComputerType.xps)
              return (new xps());
          else if (compType == Computer.ComputerType.inspiron)
              return new inspiron();
          else
              return null;
      }
  }
  
  //Concrete factory
  class Hp : ComputerFactory
  {
      public override Computer BuildComputer(Computer.ComputerType compType)
      {
          if (compType == Computer.ComputerType.envoy)
              return (new envoy());
          else if (compType == Computer.ComputerType.presario)
              return new presario();
          else
              return null;
      }
  }
  
  //Abstract product
  public abstract class Computer
  {
      public abstract string Mhz { get; set; }
      public enum ComputerType
      {
          xps,
          inspiron,
          envoy,
          presario
      }
  }
  
  //Concrete product for DELL
  public class xps : Computer
  {
      string _mhz = string.Empty;
  
      public override string Mhz
      {
          get
          {
              return _mhz;
          }
          set
          {
              _mhz = value;
          }
      }
  }
  
  //Concrete product for DELL
  public class inspiron : Computer
  {
      string _mhz = string.Empty;
  
      public override string Mhz
      {
          get
          {
              return _mhz;
          }
          set
          {
              _mhz = value;
          }
      }
  }
  
  //Concrete product for HP
  public class envoy : Computer
  {
      string _mhz = string.Empty;
  
      public override string Mhz
      {
          get
          {
              return _mhz;
          }
          set
          {
              _mhz = value;
          }
      }
  }
  
  //Concrete product for HP
  public class presario : Computer
  {
      string _mhz = string.Empty;
  
      public override string Mhz
      {
          get
          {
              return _mhz;
          }
          set
          {
              _mhz = value;
          }
      }
  }
  
  public class BestBuy
  {
      ComputerFactory compFactory;
      Computer comp;
      public BestBuy(Computer.ComputerType compType)
      {
          if (compType == Computer.ComputerType.xps || compType == Computer.ComputerType.inspiron)
              compFactory = new Dell();
          else
              compFactory = new Hp();
  
          comp = compFactory.BuildComputer(compType);
      }
  
      public Computer Sell()
      {
          return comp;
      }
  }
  </code></pre>
  
  <p>Thanks in advance.</p>