using System; using System.Collections; using System.Collections.Generic; namespace RickyTest { public class Starter { static void Main() { Cat ricky = new Cat("Ricky the Cat"); Cat amanda = new Cat("Amanda the Cat"); Cat amy = new Cat("Amy the Cat"); Dog rickywh = new Dog("RickyWH the Dog"); Dog jim = new Dog("Jim the Dog"); Dog keith = new Dog("Keith the Dog"); Animals[] myPets = { ricky, amanda, amy, rickywh, jim, keith }; foreach(Animals pet in myPets) { pet.Walking(); Console.WriteLine(typeof(pet)); } } } public interface LivingThings { void Breathing(); void Running(); void Walking(); void Noises(); } public interface Animals: LivingThings { void DoStuff(); } public class Cat: Animals { public static int numberOfCats; public string name; public Cat(string name) { this.name = name; Console.WriteLine("{0} was just created", this.name); Cat.numberOfCats++; } public void Breathing() { Console.WriteLine("Cat breaths in and out."); } public void Running() { Console.WriteLine("Cat runs around the room."); } public void Walking() { Console.WriteLine("Cat walks downtown and back."); } public void Noises() { Console.WriteLine("MEEEOOW!"); } public void DoStuff() { Console.WriteLine("Cat chases a mouse!."); } } public class Dog: Animals { public static int numberOfDogs; public string name; public Dog(string name) { this.name = name; Console.WriteLine("{0} has just been created", this.name); Dog.numberOfDogs++; } public void Breathing() { Console.WriteLine("Dog breaths some fresh air."); } public void Running() { Console.WriteLine("Dog runs around in the room."); } public void Walking() { Console.WriteLine("Dog walks to the pool."); } public void Noises() { Console.WriteLine("BARK BARK! ruff!"); } public void DoStuff() { Console.WriteLine("Dog fetches a bone."); } } }