Esempio n. 1
0
 static void Main(string[] args)
 {
     var velociraptor = new Velociraptor("Brown", "Small");
     var triceratops  = new Triceratops();
     var dinoHandler  = new DinoHandler();
     var forklift     = new Forklift();
 }
Esempio n. 2
0
        static void AbstractDemo()
        {
            TRex        myTrex        = new TRex();
            Triceratops myTriceratops = new Triceratops();

            myTrex.EatFood();
            myTrex.Move();
            myTrex.Sleeps();
            myTrex.Communicates();
            myTrex.SkinType();
            myTrex.Teeth();

            Console.WriteLine(" ");

            myTriceratops.EatFood();
            // has not been overwritten so "the dinosaur moves"
            myTriceratops.Move();
            myTriceratops.Sleeps();
            myTriceratops.Communicates();
            myTriceratops.SkinType();
            myTriceratops.Teeth();

            Console.WriteLine(" ");

            Teradactyl myTeradactyl = new Teradactyl();

            myTeradactyl.EatFood();
            myTeradactyl.Move();
            myTeradactyl.Sleeps();
            myTeradactyl.Communicates();
            myTeradactyl.Teeth();
            myTeradactyl.SkinType();
        }
Esempio n. 3
0
        static void Main(string[] args)
        {
            Triceratops triceratops = new Triceratops();
            var         child       = ChildCreator.CreateChild(new TriceratopsToMammalAdapter(triceratops));

            child.Cry();
        }
Esempio n. 4
0
 static void AbstractDemo()
 {
     TRex           trex = new TRex();
     Triceratops    tri  = new Triceratops();
     Archaeopteryx  arc  = new Archaeopteryx();
     NarratorLizard nl   = new NarratorLizard();
 }
Esempio n. 5
0
        public static void AdapterExample()
        {
            var triceratops = new Triceratops();

            var child = ChildCreator.CreateChild(new TriceratopsToMammalAdapter(triceratops));

            child.Cry();
        }
Esempio n. 6
0
        public void Triceratops_Da_Hijo_Como_Mamifero_Y_Llora()
        {
            var triceratops          = new Triceratops();
            var triceratops_adaptado = new TriceratopsAMamiferoAdapter(triceratops);
            var hijo = CreadorDeHijo.CrearHijo(triceratops_adaptado);

            Assert.AreEqual("TRICERATOPS ESTA LLORANDO", hijo.Llorar());
        }
Esempio n. 7
0
        static void AbstractDemo()
        {
            TRex        trex        = new TRex();
            Triceratops triceratops = new Triceratops();

            trex.EatFood();
            trex.Move();
            trex.SkinType();

            triceratops.EatFood();
            triceratops.Move();
            triceratops.Teeth();
        }
Esempio n. 8
0
        static void AbstractDemo()
        {
            Trex        trex        = new Trex();
            Triceratops triceratops = new Triceratops();

            trex.EatFood();
            trex.Move();
            trex.Speed();
            trex.Habitat();

            triceratops.EatFood();
            triceratops.Move();
            triceratops.Speed();
            triceratops.Habitat();
        }
Esempio n. 9
0
        static void Main(string[] args)
        {
            var utahraptor  = new Utahraptor();
            var triceratops = new Triceratops();
            var stygimoloch = new Stygimoloch();
            var stegosaurus = new Stegosaurus();
            var dinos       = new DinoBase[] { utahraptor, triceratops, stegosaurus, stygimoloch };

            var boxer     = new Boxer();
            var rotweiler = new Rotweiler();
            var chihuahua = new Chihuahua();
            var dogs      = new DogBase[] { boxer, rotweiler, chihuahua };

            Console.WriteLine("Do You want to learn about dogs or dinosaurs? (dog/dino)");

            string answer = Console.ReadLine();

            if (answer == "dino")
            {
                foreach (var dino in dinos)
                {
                    dino.PrintDinos();
                    dino.Carnivore();
                    Console.ReadLine();
                }
            }
            else if (answer == "dog")
            {
                foreach (var dog in dogs)
                {
                    dog.PrintDogs();
                    dog.Loyalty();
                    Console.ReadLine();
                }
            }
        }
Esempio n. 10
0
 public TriceratopsToMammalAdapter(Triceratops triceratops)
 {
     this.triceratops = triceratops;
 }