static void Main(string[] args)
        {
            //Create one (or more if you like) instances of each type of animal and each container. Then add the animals to their corresponding container.
            var horse = new LandAnimal()
            {
                AnimalName = "Horse"
            };
            var spider = new LandAnimal()
            {
                AnimalName = "Spider"
            };

            var robin = new SkyAnimal()
            {
                AnimalName = "Robin"
            };
            var blueJay = new SkyAnimal()
            {
                AnimalName = "Blue Jay"
            };

            var shark = new WaterAnimal()
            {
                AnimalName = "Hammer Head Shark"
            };
            var dolphin = new WaterAnimal()
            {
                AnimalName = "Bottle Nose Dolphin"
            };


            var WalkContainer = new WalkContainer();

            WalkContainer.Walkers = new List <IWalker> {
                horse, spider
            };

            var FlyContainer = new FlyContainer();

            FlyContainer.Fliers = new List <IFlier>()
            {
                robin, blueJay
            };

            var SwimContainer = new SwimContainer();

            SwimContainer.Swimmers = new List <ISwimmer> {
                shark, dolphin
            };

            spider.Run(8);
            horse.Walk(4);
            robin.Clean();
            blueJay.Fly("blue");
            shark.Live();
            dolphin.Swim(2);
        }
Example #2
0
        static void Main(string[] args)
        {
            SkyAnimal parakeet = new SkyAnimal {
                Name = "parakeet"
            };
            LandAnimal earthworm = new LandAnimal {
                Name = "earthworm"
            };
            WaterAndLandAnimal terrapin = new WaterAndLandAnimal {
                Name = "terrapin"
            };
            WaterAnimal bettaFish = new WaterAnimal {
                Name = "betta fish"
            };
            LandAnimal gerbil = new LandAnimal {
                Name = "gerbil"
            };
            SkyAnimal finch = new SkyAnimal {
                Name = "finch"
            };

            var SkyContainer = new SkyContainer();

            SkyContainer.SkyAnimals = new List <IFlying>()
            {
                finch, parakeet
            };

            var LandContainer = new LandContainer();

            LandContainer.LandAnimals = new List <IWalking>()
            {
                gerbil, earthworm
            };

            var WaterContainer = new WaterContainer();

            WaterContainer.WaterAnimals = new List <ISwimming>()
            {
                bettaFish, terrapin
            };

            parakeet.Fly();
        }