Create an abstract Animal class that has private members weight and name , and abstract methods Speak( ) , Move( ) , and ToString( ) . Derive from Animal a Cat and Dog class that override the methods appropriately. Create an Animal array, populate it with Dogs and Cats , and then call each member's overridden virtual method.
Exercise 14-2
Replace the array in Exercise 14-1 with a List . Sort the animals by size . You can simplify by just calling ToString( ) before and after the sort. Remember that you'll need to implement IComparable .
Exercise 14-3
Replace the list from Exercise 14-2 with both a Stack and a Queue , and see the difference in the order in which the animals are returned.
Exercise 14-4
Rewrite Exercise 14-2 to allow Animals to be sorted either by weight or alphabetically by name.