title: Can you help me understand in a practical example the usage abstract classes vs interfaces?
body: <p>Can you give me an almost overly simplistic understanding of abstract class vs inheritance use and help me so I can truly understand the concept and how to implement? I have a project I'm trying to complete, and am lost on how to implement. I've been chatting with my professor and been told off pretty much, saying that if I can't figure it out, I'm probably not ready for the course. I have OVERCOVERED the prerequestite courses, and still have trouble understanding these concepts. </p>
  
  <p>To clarify, the project as I've done so far is below. I don't have the dog/cat classes etc filled out yet. Can you give me a pointer. I'm not asking for anyone to give me the "answers." I just am lost on where to go with this. I take online courses and his communication efforts with me have been troubling. I just finished with 4.0 with all my other courses, so I'm willing to put the effort in, but I'm lost in the comprehension of these concepts and how to PRACTICALLY apply them. </p>
  
  <p>Any comments or help that will let me progress further in this project?</p>
  
  <p>The description of what I'm to implement is as follows:</p>
  
  <blockquote>
    <p>Overview:</p>
    
    <p>The purpose of this exercise is to
    demonstrate the use of Interfaces,
    Inheritance, Abstract classes, and
    Polymorphism.   Your task is to take
    the supplied program shell and ADD the
    appropriate classes and corresponding
    class members/methods   to get this
    program to function correctly. You may
    not make changes to any of the code
    supplied, you may only add the classes
    you write.    Although there are
    numerous ways to get the program
    working, you must use techniques that
    demonstrate the use of Interfaces,<br>
    Inheritance, Abstract classes, and
    Polymorphism. Again, to make clear,
    you can add to the supplied code but
    you cannot change or    delete any of
    it. The code that is supplied will
    work with very little additional code
    and will satisfy the requirements of
    the exercise.  </p>
    
    <p>If you successfully complete the
    assignment, your program should output
    the following statements when run:</p>
    
    <p>My name is Spot, I am a Dog</p>
    
    <p>My name is Felix, I am a Cat</p>
    
    <p>Requirements:</p>
    
    <p>1) You must have an abstract base
    class called 'Animal' from which the
    Dog and Cat classes derive.  </p>
    
    <p>2) The Animal base class must derive
    from the Interface 'IAnimal', it is
    the only class that should derive from
    IAnimal.</p>
    
    <p>3) Since all animals have a name and a
    name is not an attribute that is
    specific to a dog or a cat, the Animal</p>
    
    <p>base class should be where the name
    is stored and where the WhatIsMyName
    get-property is implemented.</p>
    
    <p>4) You will need to create a Dog and a
    Cat class that will derive only from
    the Animal base class.   </p>
    
    <p>5) The Dog and Cat classes should
    implement the WhatAmI get-property and
    return the appropriate string value.</p>
  </blockquote>
  
  <p>Code you can't change:</p>
  
  <pre><code>using System;
  
  namespace IT274_U2
  {
      public interface IAnimal
      {
          string WhatAmI { get; }
          string WhatIsMyName { get; }
      }
  
      public class TesterClass
      {
          public static void DescribeAnimal(IAnimal animal)
          {
              Console.WriteLine("My name is {0}, I am a {1}", animal.WhatIsMyName, animal.WhatAmI);
          }
  
          static void Main(string[] args)
          {
              Dog mydog = new Dog("Spot");
              Cat mycat = new Cat("Felix");
              DescribeAnimal(mydog);
              DescribeAnimal(mycat);
          }
      }
  }
  </code></pre>
  
  <p>///////////////////////</p>
  
  <p>Code I've written so far: </p>
  
  <pre><code>using System;
  
  
  namespace IT274_U2
  {
      public interface IAnimal
      {
          string WhatAmI { get; }
          string WhatIsMyName { get; }
      }
  
  
      public class Dog
      {
          public abstract string WhatAmI
          {
              get;
              set;
          }
      }//end public class Dog
  
      public class Cat
      {
      public abstract string WhatIsMyName  
      {
          get;
          set;
      }
      }//end public class Cat
  
      public abstract class Animal : IAnimal
      {
      // fields
      protected string Dog;
      protected string Cat;
  
                    // implement WhatIsMyName 
  
      //properties
      public abstract String Dog
      {
          get;  
          set;
      }
      public abstract String Cat
      {
          get;
          set;
      }
      public abstract string WhatIsMyName();
  
      } //end public abstract class Animal
  
  
      public class TesterClass
      {
          public static void DescribeAnimal(IAnimal animal)
          {
              Console.WriteLine("My name is {0}, I am a {1}", animal.WhatIsMyName, animal.WhatAmI);
          }
  
          static void Main(string[] args)
          {
  
              Dog mydog = new Dog("Spot");
              Cat mycat = new Cat("Felix");
              DescribeAnimal(mydog);
              DescribeAnimal(mycat);
          }
      }
  }
  </code></pre>