title: interface vs abstract class
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/1165332/interface-or-abstract-class">Interface or abstract class?</a>  </p>
  </blockquote>
  
  
  
  <p>I have a group of classes defined as follows:</p>
  
  <pre><code>namespace VGADevices.UsingAbstractClass
  {
      public abstract class VGA
      {
          public abstract int HorizontalResolution { get; set; }
          public abstract int VerticalResolution { get; set; }
      }
      public class LCDScreen : VGA
      {
          public override int HorizontalResolution { get; set; }
          public override int VerticalResolution { get; set; }
      }
  }  // namespace VGADevices.UsingAbstractClass
  
  namespace VGADevices.UsingInterfaces
  {
      public interface IVGA
      {
          int HorizontalResolution { get; set; }
          int VerticalResolution { get; set; }
      }
      public class LCDScreen : IVGA
      {
          public virtual int HorizontalResolution { get; set; }
          public virtual int VerticalResolution { get; set; }
      }
  }  // namespace VGADevices.UsingInterfaces
  </code></pre>
  
  <p>Client code, I have the choice between:</p>
  
  <pre><code>class Computer
  {
          public VGA VGAOutput { get; set; }
  }
  </code></pre>
  
  <p>or</p>
  
  <pre><code>class Computer
  {
          public IVGA VGAOutput { get; set; }
  }
  </code></pre>
  
  <p>I read somewhere that using interfaces is better, but why?
  With abstract classes I can define an interface as well plus add data-members so why are interfaces the preferred method?
  Does binary replacement play a role here as well?</p>
  
  <p>thank you</p>
  
  <p>Chris</p>