Exemplo n.º 1
0
        static void Main(string[] args)
        {
            var PaintedDog = new LandAnimal()
            {
                Name = "Painted Dog"
            };
            var SeaTurtle = new Amphibian()
            {
                Name = "Sea Turtle"
            };
            var Finch = new SkyAnimal()
            {
                Name = "Finch"
            };
            var Shark = new WaterAnimal()
            {
                Name = "Shark"
            };
            var Bear = new LandAnimal()
            {
                Name = "Bear"
            };
            var PoisonFrog = new Amphibian()
            {
                Name = "Poison Frog"
            };
            var Eagle = new SkyAnimal()
            {
                Name = "Eagle"
            };
            var Seahorse = new WaterAnimal()
            {
                Name = "Seahorse"
            };

            var FlyerContainer = new FlyerContainer();

            FlyerContainer.Fliers = new List <IFlying>()
            {
                Finch, Eagle
            };

            var SwimmerContainer = new SwimmersContainer();

            SwimmerContainer.swimmers = new List <ISwimming>()
            {
                SeaTurtle, Shark, PoisonFrog, Seahorse
            };

            var WalkerContainer = new WalkersContainer();

            WalkerContainer.walkers = new List <IWalking>()
            {
                SeaTurtle, PoisonFrog, PaintedDog, Finch, Bear, Eagle
            };
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            var Bear = new LandAnimal()
            {
                Name = "Bear"
            };
            var Tiger = new LandAnimal()
            {
                Name = "Tiger"
            };
            var Eagle = new FlyAnimal()
            {
                Name = "Eagle"
            };
            var Cardinal = new FlyAnimal()
            {
                Name = "Cardinal"
            };
            var Frog = new Amphibian()
            {
                Name = "Frog"
            };
            var Salamander = new Amphibian()
            {
                Name = "Salamander"
            };
            var Shark = new WaterAnimal()
            {
                Name = "Shark"
            };
            var StingRay = new WaterAnimal()
            {
                Name = "Sting Ray"
            };
            var EarthWorm = new LandAnimal()
            {
                Name = "Earth Worm"
            };
            var RattleSnake = new LandAnimal()
            {
                Name = "Rattle Snake"
            };

            var FlyContainer = new FlierContainer();

            FlyContainer.Fliers = new List <IFlier>()
            {
                Eagle, Cardinal
            };

            var SwimmerContainer = new SwimmerContainer();

            SwimmerContainer.Swimmers = new List <ISwimmer>()
            {
                Frog, Salamander, Shark, StingRay
            };

            var WalkerContainer = new WalkerContainer();

            WalkerContainer.Walkers = new List <IWalker>()
            {
                Bear, Tiger, Frog, Salamander, EarthWorm, RattleSnake
            };

            Eagle.Fly();
            Salamander.Swim();
            EarthWorm.Dig();
            Tiger.Run();
            StingRay.Swim();
        }